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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
130
プロポーザルに込める段取り八分
shoheimitani
1
170
セキュリティについて学ぶ会 / 2026 01 25 Takamatsu WordPress Meetup
rocketmartue
1
290
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
140
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
42k
20260204_Midosuji_Tech
takuyay0ne
0
120
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.3k
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.9k
Embedded SREの終わりを設計する 「なんとなく」から計画的な自立支援へ
sansantech
PRO
3
2.2k
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
1
280
Featured
See All Featured
KATA
mclloyd
PRO
34
15k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
230
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
110
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
So, you think you're a good person
axbom
PRO
2
1.9k
Writing Fast Ruby
sferik
630
62k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
91
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