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
350
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
TypeScriptはどのようにどこまで推論できるのか ─ とにかく as は禁止で
ypresto
3
420
キャリア25年目にしてTypeScript に出会うまで - 「型」を通じて振り返るプログラミング言語遍歴 / Meeting TypeScript After 25 Years in Tech - Looking Back at My Programming Language Journey Through "Types"
bitkey
PRO
2
280
類似画像検索モデルの開発ノウハウ
lycorptech_jp
PRO
3
800
Python開発環境にハーネス適用を検討する
yuuka51
1
510
まだ道半ば、AI-DLCを歩み始めている話
news_it_enj
2
170
TSKaigi 2026 - Auth.jsからBetter Authへの 移行に見る「型とランタイム」の 設計思想の変化
teamlab
PRO
1
260
Typiaで配信JSONの安全性を構造的に担保する(TSKaigi2026)
righttouch
PRO
1
170
情シスがMCP環境導入時に打ちのめされる認可の崖
oidfj
0
450
ソフトウェアサプライチェーン攻撃対策として今からサクッとできること
flatt_security
2
130
[みん強]AIの価値を最大化するデータ基盤戦略:Self-Service型Data Meshへの転換とAgentic AI Meshに向けた取り組み with Snowflake他
y_matsubara
1
180
freee-mcpを Local→Remote で出してわかった MCP認可実装のリアル
terara
3
620
データ基盤構築・運用の現場から 〜 Snowflake Intelligence 導入で変わった、データ活用の未来 〜
wonohe
0
180
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
200
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
530
First, design no harm
axbom
PRO
2
1.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
340
Why Our Code Smells
bkeepers
PRO
340
58k
Navigating Weather and Climate Data
rabernat
0
200
Abbi's Birthday
coloredviolet
2
7.7k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
310
Speed Design
sergeychernyshev
33
1.7k
The Cult of Friendly URLs
andyhume
79
6.9k
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