Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Why Best Practices?
Search
jeg2
August 04, 2013
Technology
3
340
Why Best Practices?
This is JEG2's segment of the Ruby Rogues panel form LSRC 2013.
jeg2
August 04, 2013
Tweet
Share
More Decks by jeg2
See All by jeg2
How to Level Up in Elixir
jeg2
2
160
Motivation
jeg2
1
130
Coding in the Classroom
jeg2
0
150
Implementing the LHC on a Whiteboard
jeg2
3
810
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
430
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
940
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
AIと融ける人間の冒険
pujisi
0
110
「違う現場で格闘する二人」——社内コミュニティがつないだトヨタ流アジャイルの実践とその先
shinichitakeuchi
0
200
サラリーマンソフトウェアエンジニアのキャリア
yuheinakasaka
30
15k
Redshift認可、アップデートでどう変わった?
handy
1
130
「リリースファースト」の実感を届けるには 〜停滞するチームに変化を起こすアプローチ〜 #RSGT2026
kintotechdev
0
720
AI時代のアジャイルチームを目指して ー スクラムというコンフォートゾーンからの脱却 ー / Toward Agile Teams in the Age of AI
takaking22
11
5.4k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
60k
「駆動」って言葉、なんかカッコイイ_Mitz
comucal
PRO
0
140
わが10年の叡智をぶつけたカオスなクラウドインフラが、なくなるということ。
sogaoh
PRO
1
360
技術選定、下から見るか?横から見るか?
masakiokuda
0
180
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
1万人を変え日本を変える!!多層構造型ふりかえりの大規模組織変革 / 20260108 Kazuki Mori
shift_evolve
PRO
6
1k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Code Review Best Practice
trishagee
74
19k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
170
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.8k
Abbi's Birthday
coloredviolet
0
4.2k
Between Models and Reality
mayunak
1
160
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Amusing Abliteration
ianozsvald
0
84
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
140
The Cost Of JavaScript in 2023
addyosmani
55
9.4k
Six Lessons from altMBA
skipperchong
29
4.1k
Transcript
I Only Have Time to Make One Point The others
made me include this slide!
.
Thanks!
Why Best Practices?
How Should We Use Struct? class Specialized < Struct.new(:whatever) #
... define custom methods here... end Specialized = Struct.new(:whatever) do # ... define custom methods here... end
I Prefer the Block Form But that’s not the point!
Code Similarity and Malleability Specialized = Struct.new(:whatever) do # ...
define custom methods here... end Trivial = Struct.new(:whatever)
An Extra Class • The anonymous class doesn’t tell us
much • Code reloading may cause “TypeError: superclass mismatch…” [Specialized, #<Class:0x007f8ba7389d18>, Struct, Enumerable, Object, PP::ObjectMixin, Kernel, BasicObject] class Specialized < Struct.new(:whatever) # ... define custom methods here... end
The “super” Problem class Specialized < Struct.new(:whatever) def whatever super
|| :default end include SomeMixin end Specialized = Struct.new(:whatever) do def whatever self[:whatever] || :default end prepend SomeMixin end
The Point • It’s not about the one right way
to code • It’s about what we learn in the discussion • This trivial example alone includes: • Code malleability • The ancestor class chain • The value of prepend