Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Don't Get Clever
avdi
July 20, 2013
1
180
Don't Get Clever
Part of the Ruby Rogues live panel episode at Lone Star Ruby Conference 2013.
avdi
July 20, 2013
Tweet
Share
More Decks by avdi
See All by avdi
Pairing is Caring
avdi
2
220
Code to Joy
avdi
10
1.3k
Building Gems that Don't Suck
avdi
4
370
Making Little Classes out of Big Ones
avdi
29
3.1k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
19
2.9k
What the flash - Photography Introduction
edds
61
10k
Product Roadmaps are Hard
iamctodd
34
6.5k
Building Flexible Design Systems
yeseniaperezcruz
310
34k
Intergalactic Javascript Robots from Outer Space
tanoku
261
25k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
Making the Leap to Tech Lead
cromwellryan
113
7.4k
Building a Scalable Design System with Sketch
lauravandoore
447
30k
Writing Fast Ruby
sferik
612
57k
The Web Native Designer (August 2011)
paulrobertlloyd
74
1.9k
No one is an island. Learnings from fostering a developers community.
thoeni
9
1.1k
Designing for Performance
lara
597
63k
Transcript
Don't Get Clever Avdi Grimm
Pop quiz r e q u i r e '
p s t o r e ' s t o r e = P S t o r e . n e w ( ' d a t a . p s t o r e ' ) s t o r e . t r a n s a c t i o n ( t r u e ) d o # . . . e n d
Pop quiz 2 A r r a y . i
n s t a n c e _ m e t h o d s ( f a l s e )
Symbols are truthy r e q u i r e
' p s t o r e ' s t o r e = P S t o r e . n e w ( ' d a t a . p s t o r e ' ) s t o r e . t r a n s a c t i o n ( : r e a d _ o n l y ) d o # . . . e n d
Clever!
What's : r e a d _ o n l
y ?? s t o r e . t r a n s a c t i o n ( : r e a d _ o n l y ) d o # . . . e n d
Dead end s t o r e . t r
a n s a c t i o n ( : c h u n k y _ b a c o n ) d o # . . . e n d
Negation A r r a y . i n s
t a n c e _ m e t h o d s ( ! : i n c l u d e _ s u p e r )
Don't get clever
Intention-revealing argument r e a d _ o n l
y = t r u e s t o r e . t r a n s a c t i o n ( r e a d _ o n l y ) d o # . . . e n d
Intention-revealing argument i n c l u d e _
s u p e r = f a l s e A r r a y . i n s t a n c e _ m e t h o d s ( i n c l u d e _ s u p e r )
Inline version A r r a y . i n
s t a n c e _ m e t h o d s ( i n c l u d e _ s u p e r = f a l s e )
Don't get clever