Triangle.rb Notes - Nothing Is Something
http://www.meetup.com/raleighrb/events/224075188/
2015-08-11 by Sandi Metz (video of the same talk at RailsConf)
- Smalltalk infected
- Condition adverse
- Message sending
- Abstraction seeking
Bunch of code slides here...
Ruby has special syntax for booleans
Conditions breed!
Null Object Pattern - "Active Nothing"
Prefer knowing object over duplicating behavior
Prefer fewer objects
if
statements are a smell, but you can't get rid of all of them, especially along the boundaries.
"The House That Jack Built" song
Inheritance is for specialization, not for sharing code!
Reveal how things differ by making them more alike
Composition and Dependency Injection!
Getting the abstractions right will vastly improve your code. If you're talking to nil
, it's something.
Stop using inheritance as soon as code is getting duplicated. Use composition instead.
Isolate the thing that varies
... FIXME three other bullet points here, but need to look up