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
360
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
180
Motivation
jeg2
1
140
Coding in the Classroom
jeg2
0
180
Implementing the LHC on a Whiteboard
jeg2
3
840
The Patterns We All Need to Know
jeg2
15
1.3k
Command-line Ruby
jeg2
5
460
10 Things You Didn't Know Ruby Could do
jeg2
200
54k
The Aspects of Programming
jeg2
12
970
The M Word
jeg2
3
1.1k
Other Decks in Technology
See All in Technology
テストコードのないプロジェクトにテストを根付かせる
tttol
1
240
さきさん文庫の書籍ができるまで
sakiengineer
0
320
GitHub Copilot CLIでWebアクセシビリティを改善した話
tomokusaba
0
140
Kaggle未経験社員をメダリストに育てる「AIドラゴン桜」
lycorptech_jp
PRO
0
680
地元にいないローカルオーガナイザーの立ち回り
uvb_76
1
400
TypeScript Compiler APIとPHP-Parserを活用し、TypeScriptとPHPで型を共有する
shuta13
0
270
layerx-fde-practices
cipepser
6
2.9k
AIが変えた"品質の守り方"
kkakizaki
13
5.5k
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
380
Sony_KMP_Journey_KotlinConf2026
sony
1
180
AIプラットフォームを運用し続けるための可観測性
tanimuyk
4
760
Javaコミュニティをもっと楽しむための9箇条
takasyou
0
790
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
520
Speed Design
sergeychernyshev
33
1.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Building Applications with DynamoDB
mza
96
7.1k
Agile that works and the tools we love
rasmusluckow
331
21k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
300
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
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