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
350
3
Share
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
170
Motivation
jeg2
1
140
Coding in the Classroom
jeg2
0
180
Implementing the LHC on a Whiteboard
jeg2
3
830
The Patterns We All Need to Know
jeg2
15
1.2k
Command-line Ruby
jeg2
5
460
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
AIエージェントの権限管理 1: MCPサーバー・ツールの Fine grained access control 編
ren8k
3
490
No Types Needed, Just Callable Method Check
dak2
1
990
ハーネスエンジニアリングの概要と設計思想
sergicalsix
9
4.8k
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
320
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
弁護士ドットコム株式会社 エンジニア職向け 会社紹介資料
bengo4com
1
140
AWS認定資格は本当に意味があるのか?
nrinetcom
PRO
1
270
Code Interpreter で、AIに安全に コードを書かせる。
yokomachi
0
7.1k
レビューしきれない?それは「全て人力でのレビュー」だからではないでしょうか
amixedcolor
0
310
AI와 협업하는 조직으로의 여정
arawn
0
230
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
230
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
290
Featured
See All Featured
How to make the Groovebox
asonas
2
2.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
110
Being A Developer After 40
akosma
91
590k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
180
Ethics towards AI in product and experience design
skipperchong
2
260
YesSQL, Process and Tooling at Scale
rocio
174
15k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
190
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
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