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
360
3
Share
Why Best Practices?
This is JEG2's segment of the Ruby Rogues panel form LSRC 2013.
jeg2
August 04, 2013
More Decks by jeg2
See All by jeg2
How to Level Up in Elixir
jeg2
2
180
Motivation
jeg2
1
140
Coding in the Classroom
jeg2
0
180
Implementing the LHC on a Whiteboard
jeg2
3
840
The Patterns We All Need to Know
jeg2
15
1.3k
Command-line Ruby
jeg2
5
460
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
970
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
AI Adaptable なテストを整える工夫 / Ways to Make Your Tests AI-Adaptable
bitkey
PRO
2
190
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
270
20260528_生成AIを専属DSに_Howの次にすべきことを考える
doradora09
PRO
0
270
はじめてのDatadog
kairim0
0
240
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
300
OpenClawとHermesAgentでAI新入社員を作った話
takanoriyanada
0
150
OpenID Connectによるサービス間連携
takesection
0
150
Generative UI × A2UI で AI エージェントを作った話 AI-DLC も使ってみた!
kmiya84377
1
290
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
530
AIが変えた"品質の守り方"
kkakizaki
13
5.5k
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
700
類似画像検索モデルの開発ノウハウ
lycorptech_jp
PRO
4
1.1k
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Building Applications with DynamoDB
mza
96
7.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
320
The Curious Case for Waylosing
cassininazir
1
370
Navigating Weather and Climate Data
rabernat
0
200
The Spectacular Lies of Maps
axbom
PRO
1
770
Google's AI Overviews - The New Search
badams
0
1k
Six Lessons from altMBA
skipperchong
29
4.3k
Faster Mobile Websites
deanohume
310
31k
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