Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Why Best Practices?
Search
jeg2
August 04, 2013
Technology
380
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
200
Motivation
jeg2
1
150
Coding in the Classroom
jeg2
0
200
Implementing the LHC on a Whiteboard
jeg2
3
870
The Patterns We All Need to Know
jeg2
15
1.3k
Command-line Ruby
jeg2
5
470
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
990
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
3人で1000GPU超を統合運用する?マルチクラウド&オンプレを跨ぐ、構築と運用のリアル!
kazukun0716
2
800
AIエージェント時代のPlatform as a Product —— テックリードがPdMとして回す発見・導入・計測 / Platform as a Product in the AI Agent Era
toshi0607
1
550
BedrockとLambdaで作る リアルタイム進行型推理ゲーム
kawametho
0
140
大阪オフィスに Unitree Go2 がやってきたので Physical AI やってみた
dafujii
0
200
雪かき部 #7 もう怖くない!SELECT文!
foursue
0
270
OpenClawでAzure DevOpsのWiki更新を自動化する - クラウドAIだけでは届かない場所へ
yutakaosada
0
140
営業オントロジーの作り方と、エージェントからの辿り方 ── ナレッジワークの現場から
kworkdev
PRO
1
220
PQC移行の今 -- IETF からみた現在地
satokan
4
720
メルカリにおけるAI時代の高速プロトタイピング基盤「Arca」
ryotarai
18
14k
認知負荷を吸収し、プロダクトをまたぐPR Preview基盤の設計事例
taiki45
2
560
【ゲームメーカーズスクランブル2026】『Shadowverse: Worlds Beyond』UIとアニメーションで実現する最高のユーザー体験を叶えるプロトタイピング
cygames
PRO
1
710
データ品質を壊しながらSnowflakeのAIに分析させてみた
kawanago
0
350
Featured
See All Featured
Speed Design
sergeychernyshev
33
2.1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing for Timeless Needs
cassininazir
1
510
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
440
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
270
The World Runs on Bad Software
bkeepers
PRO
72
12k
Building an army of robots
kneath
307
47k
Ethics towards AI in product and experience design
skipperchong
2
400
Practical Orchestrator
shlominoach
192
12k
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