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
170
Motivation
jeg2
1
130
Coding in the Classroom
jeg2
0
170
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
450
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
960
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
LINEアプリ開発のための Claude Code活用基盤の構築
lycorptech_jp
PRO
2
1.3k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
管理者向けGitHub Enterpriseの運用Tips紹介: 人にもAIにも優しいプラットフォームづくり
yuriemori
0
110
EMからICへ、二周目人材としてAI全振りのプロダクト開発で見つけた武器
yug1224
3
200
Kaggleの経験が実務にどう活きているか / kaggle_findy
sansan_randd
3
430
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
650
AI が Approve する開発フロー / How AI Reviewers Accelerate Our Development
zaimy
1
260
生成AIの利用とセキュリティ /gen-ai-and-security
mizutani
0
710
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
310
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
180
20260305_【白金鉱業】分析者が地理情報を武器にするための軽量なアドホック分析環境
yucho147
0
110
Featured
See All Featured
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
The Language of Interfaces
destraynor
162
26k
HDC tutorial
michielstock
1
490
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
480
The agentic SEO stack - context over prompts
schlessera
0
680
Writing Fast Ruby
sferik
630
62k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
810
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
120
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
170
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Speed Design
sergeychernyshev
33
1.6k
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