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
360
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
190
Motivation
jeg2
1
150
Coding in the Classroom
jeg2
0
190
Implementing the LHC on a Whiteboard
jeg2
3
860
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
980
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
LanceDB入門
mocobeta
8
580
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
630
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
280
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
3
25k
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
1
6k
モバイルアプリ開発概論2026
recruitengineers
PRO
6
650
Digitization部 紹介資料
sansan33
PRO
2
7.7k
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
250
強化学習「理論」入門
enakai00
3
3.6k
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
150
ホームラボ紹介
y_sera15
0
200
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.1k
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
450
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
280
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Ethics towards AI in product and experience design
skipperchong
2
340
Designing Powerful Visuals for Engaging Learning
tmiket
1
490
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
How to Ace a Technical Interview
jacobian
281
24k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
280
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
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