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
300
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
130
Motivation
jeg2
1
93
Coding in the Classroom
jeg2
0
120
Implementing the LHC on a Whiteboard
jeg2
3
750
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
400
10 Things You Didn't Know Ruby Could do
jeg2
200
53k
The Aspects of Programming
jeg2
12
910
The M Word
jeg2
3
1k
Other Decks in Technology
See All in Technology
パスキー導入の課題と ベストプラクティス、今後の展望
ritou
7
1.3k
OPENLOGI Company Profile for engineer
hr01
1
22k
ゆるくVPC Latticeについてまとめてみたら、意外と奥深い件
masakiokuda
2
160
問題解決に役立つ数理工学
recruitengineers
PRO
8
2.4k
Enterprise AI in 2025?
pamelafox
0
120
技術好きなエンジニアが _リーダーへの進化_ によって得たものと失ったもの / The Gains and Losses of a Tech-Enthusiast Engineer’s “Evolution into Leadership”
kaminashi
0
220
OCI Database with PostgreSQLのご紹介
rkajiyama
0
110
ソフトウェアプロジェクトの成功率が上がらない原因-「社会価値を考える」ということ-
ytanaka5569
0
130
20250328_RubyKaigiで出会い鯛_____RubyKaigiから始まったはじめてのOSSコントリビュート.pdf
mterada1228
0
360
一人QA時代が終わり、 QAチームが立ち上がった話
ma_cho29
0
300
ペアーズにおけるData Catalog導入の取り組み
hisamouna
0
230
チームビルディング「脅威モデリング」ワークショップ
koheiyoshikawa
0
180
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.5k
How STYLIGHT went responsive
nonsquared
99
5.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
30k
How to Think Like a Performance Engineer
csswizardry
22
1.5k
GraphQLとの向き合い方2022年版
quramy
45
14k
Building Adaptive Systems
keathley
41
2.5k
Writing Fast Ruby
sferik
628
61k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Become a Pro
speakerdeck
PRO
27
5.2k
Rails Girls Zürich Keynote
gr2m
94
13k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
480
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