Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Why Best Practices?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
jeg2
August 04, 2013
Technology
380
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Why Best Practices?
This is JEG2's segment of the Ruby Rogues panel form LSRC 2013.
jeg2
August 04, 2013
Transcript
10 slides
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
More Decks by jeg2
See All by jeg2
How to Level Up in Elixir
jeg2
2
210
Motivation
jeg2
1
160
Coding in the Classroom
jeg2
0
220
Implementing the LHC on a Whiteboard
jeg2
3
890
The Patterns We All Need to Know
jeg2
15
1.3k
Command-line Ruby
jeg2
5
500
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
990
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
5
350
Claude Codeで新規事業を伸ばせるか? Zennの試行錯誤の記録
wadayusuke
2
200
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
11
20k
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
910
自治体AIコンタクトセンター、何をどこに任せる?~Amazon Connect Customer +Amazon Bedrockの実践知~ / 20261107 Satoshi Torano
shift_evolve
PRO
1
140
こんなに変わった! AWSネットワークの常識
shotashiratori
9
2.8k
SSFの現在地 ― CAEP/RISCからAI Identityへ
oidfj
0
450
サーバーラックは作る時代! 3Dプリンターで作る10インチラックのススメ
jacopen
1
180
AWS基盤改善を支える 私たちの理念と行動指針
kentosuzuki
0
230
少ない人手 限られた予算 それでも守る 消せない・見つける・戻れる オールハザード型BCP on AWS / 20261107 Mitsutoshi Matsuo
shift_evolve
PRO
0
390
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
0
320
gem install とrequire のむこうがわ
ydah
0
110
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
830
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
370
Facilitating Awesome Meetings
lara
57
7.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The untapped power of vector embeddings
frankvandijk
2
2k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
540
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
840
Un-Boring Meetings
codingconduct
0
500
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
330
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
930