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
160
Implementing the LHC on a Whiteboard
jeg2
3
820
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
440
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
950
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
GSIが複数キー対応したことで、俺達はいったい何が嬉しいのか?
smt7174
3
140
Mosaic AI Gatewayでコーディングエージェントを配るための運用Tips / JEDAI 2026 新春 Meetup! AIコーディング特集
genda
0
150
Digitization部 紹介資料
sansan33
PRO
1
6.8k
今日から始めるAmazon Bedrock AgentCore
har1101
4
390
M&A 後の統合をどう進めるか ─ ナレッジワーク × Poetics が実践した組織とシステムの融合
kworkdev
PRO
1
400
What happened to RubyGems and what can we learn?
mikemcquaid
0
240
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
120
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
200
月間数億レコードのアクセスログ基盤を無停止・低コストでAWS移行せよ!アプリケーションエンジニアのSREチャレンジ💪
miyamu
0
800
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.8k
セキュリティ はじめの一歩
nikinusu
0
1.5k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
820
Evolving SEO for Evolving Search Engines
ryanjones
0
120
Docker and Python
trallard
47
3.7k
What's in a price? How to price your products and services
michaelherold
247
13k
Designing Powerful Visuals for Engaging Learning
tmiket
0
220
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
[SF Ruby Conf 2025] Rails X
palkan
0
740
Typedesign – Prime Four
hannesfritz
42
2.9k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
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