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
330
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
120
Coding in the Classroom
jeg2
0
150
Implementing the LHC on a Whiteboard
jeg2
3
800
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
420
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
940
The M Word
jeg2
3
1k
Other Decks in Technology
See All in Technology
グローバルなコンパウンド戦略を支えるモジュラーモノリスとドメイン駆動設計
kawauso
3
8.9k
AI駆動開発を実現するためのアーキテクチャと取り組み
baseballyama
17
13k
Service Monitoring Platformについて
lycorptech_jp
PRO
0
360
マルチドライブアーキテクチャ: 複数の駆動力でプロダクトを前進させる
knih
0
10k
SRE視点で振り返るメルカリのアーキテクチャ変遷と普遍的な考え
foostan
2
1.4k
入社したばかりでもできる、 アクセシビリティ改善の第一歩
unachang113
2
350
都市スケールAR制作で気をつけること
segur
0
200
AI開発の定着を推進するために揃えるべき前提
suguruooki
1
300
メッセージ駆動が可能にする結合の最適化
j5ik2o
9
1.6k
Datadog LLM Observabilityで実現するLLMOps実践事例 / practical-llm-observability-with-datadog
k6s4i53rx
0
150
学術的根拠から読み解くNotebookLMの音声活用法
shukob
0
420
リアーキテクティングのその先へ 〜品質と開発生産性の壁を越えるプラットフォーム戦略〜 / architecture-con2025
visional_engineering_and_design
0
7k
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.4k
Fireside Chat
paigeccino
41
3.7k
Code Reviewing Like a Champion
maltzj
527
40k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
118
20k
Rails Girls Zürich Keynote
gr2m
95
14k
Facilitating Awesome Meetings
lara
57
6.6k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Side Projects
sachag
455
43k
For a Future-Friendly Web
brad_frost
180
10k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Navigating Team Friction
lara
190
16k
Docker and Python
trallard
46
3.7k
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