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
210
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
480
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
From Developer Experience to Agentic Experience: The Next Evolution of APIs
benjagm
0
100
Let's Change Our World—Again
snoozer05
PRO
4
310
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
110
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
380
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
990
「エーアイ」をバズワードにしないために RPA 導入経験と Kiro 上での Claude モデル利用経験から
kazzpapa3
0
110
Metadata - Section 2: Simple Metadata & Meta Tags
mohab1
0
100
小規模OSSモデルは サイバーセキュリティ業務に どこまで使えるか
bbrbbq
0
170
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
170
古い指輪から広がった JAVA コミュニティ とのつながり
yamad
0
140
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
2
370
生成AI時代、PMは事業責任者に進化するともっと面白い〜PMだからこそ事業構造を動かせる時代に〜
kakehashi
PRO
0
210
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Technical Leadership for Architectural Decision Making
baasie
3
610
Building the Perfect Custom Keyboard
takai
2
910
Git: the NoSQL Database
bkeepers
PRO
433
67k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Building Applications with DynamoDB
mza
96
7.2k
Design in an AI World
tapps
1
360
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
870
Large-scale JavaScript Application Architecture
addyosmani
516
110k
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