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
370
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
200
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
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
20260912_スクラムにジェネラリストは必要か
ryugen04
0
420
データ_AIの事業の勝敗をわけるもの
nek0128
0
370
Spring BootからQuarkusへの移行
tatsuya1bm
2
120
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
29
24k
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
0
120
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
160
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
160
銀行勘定系システムにおける開発プロセス刷新×AIによる環境モダナイゼーション / Development Process Transformation and AI-Driven Environment Modernization
muit
0
2.2k
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
200
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
610
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
8
4.2k
Screen Lens - 今見てる画面を翻訳する
komagata
0
310
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
We Are The Robots
honzajavorek
0
370
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
690
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Making Projects Easy
brettharned
120
6.8k
Leo the Paperboy
mayatellez
10
2.3k
Optimizing for Happiness
mojombo
378
71k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
570
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