RailsConf 2014 - All the Little Things by Sandi Metz
ConfreaksYouTube ↗
Further reading 4
What makes an object useful? →Compare refactoring a pricing rule into small objects with the cost of coordinating objects that carry mutable state. A class boundary alone says little about how its users interact.Small objects or small interfaces? →One talk breaks code into smaller responsibilities. The other limits what callers must learn. Count the decisions exposed to callers as well as the objects inside the implementation.Is removing duplication worth another abstraction? →Metz weighs the cost of a wrong abstraction against repeated code. Ousterhout asks how much capability a module hides behind a simple interface.Can small components still be tightly coupled? →Changing component size and changing how components communicate are separate decisions. Passing a value can remove a dependency on a synchronous call.
Caption notes
Refactor the Gilded Rose pricing rules in small, tested steps. Metz tolerates duplication until a useful abstraction becomes visible.
Original passages · 5
It is far cheaper to keep duplication than it is to have to mess
with the wrong abstraction.I have separated
the reason I'm switching from the thing I do when I switch.Intermediate refactorings often
make code more complicated, but if you know the rules,make smaller thingsIt is far cheaper to keep duplication than it is to have to mess with the wrong abstraction.