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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
jeg2
August 04, 2013
Technology
3
340
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
130
Coding in the Classroom
jeg2
0
160
Implementing the LHC on a Whiteboard
jeg2
3
820
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
440
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
950
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
Cosmos World Foundation Model Platform for Physical AI
takmin
0
970
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.6k
OpenShiftでllm-dを動かそう!
jpishikawa
0
140
登壇駆動学習のすすめ — CfPのネタの見つけ方と書くときに意識していること
bicstone
3
130
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
190
SchooでVue.js/Nuxtを技術選定している理由
yamanoku
3
190
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
[CV勉強会@関東 World Model 読み会] Orbis: Overcoming Challenges of Long-Horizon Prediction in Driving World Models (Mousakhan+, NeurIPS 2025)
abemii
0
150
今日から始めるAmazon Bedrock AgentCore
har1101
4
420
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
130
Agent Skils
dip_tech
PRO
0
130
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
2k
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
920
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
67
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
170
The Spectacular Lies of Maps
axbom
PRO
1
530
Site-Speed That Sticks
csswizardry
13
1.1k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
Exploring anti-patterns in Rails
aemeredith
2
250
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
110
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
350
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