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
930
The M Word
jeg2
3
1k
Other Decks in Technology
See All in Technology
未回答質問の回答一覧 / 開発をリードする品質保証 QAエンジニアと開発者の未来を考える-Findy Online Conference -
findy_eventslides
0
340
Post-AIコーディング時代のエンジニア生存戦略
shinoyu
0
300
スタートアップの事業成長を支えるアーキテクチャとエンジニアリング
doragt
1
4.6k
How We Built a Secure Sandbox Platform for AI
flatt_security
1
100
大規模プロダクトで実践するAI活用の仕組みづくり
k1tikurisu
5
1.7k
Service Monitoring Platformについて
lycorptech_jp
PRO
0
320
自然言語でAPI作業を片付ける!「Postman Agent Mode」
nagix
0
110
身近なCSVを活用する!AWSのデータ分析基盤アーキテクチャ
koosun
0
2.2k
入社したばかりでもできる、 アクセシビリティ改善の第一歩
unachang113
2
340
DDD x Microservice Architecture : Findy Architecture Conf 2025
syobochim
12
3.1k
Capitole du Libre 2025 - Keynote - Cloud du Coeur
ju_hnny5
0
120
Greenは本当にGreenか? - B/GデプロイとAPI自動テストで安心デプロイ
kaz29
0
110
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
39
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
RailsConf 2023
tenderlove
30
1.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
54k
Practical Orchestrator
shlominoach
190
11k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Building Applications with DynamoDB
mza
96
6.8k
Documentation Writing (for coders)
carmenintech
76
5.1k
Music & Morning Musume
bryan
46
7k
Done Done
chrislema
186
16k
Bash Introduction
62gerente
615
210k
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