Nothing is Something

May 30, 2017

I stumbled across Sandi Metz’s talk a few days ago, and found time to watch it today. I’m no expert on Object Oriented design, so this was definitely an eye opener.

Take Aways

Don’t use conditionals for checking for nil.
Don’t use inheritance to share code.
Learn that non-physical/non-traditional things can be modeled as objects.
Get into the habit of composing a class (object), then create other classes (roles) and inject them in other classes to modify specific behavior of the objects.
If a specific, default behavior is modified, make sure to define the default behavior as well.
Now you have a vanilla object with dependencies, and it’s arbitrary to define the default behavior or modify it.


The examples were all in Ruby, so need to figure out syntax/structure in Python.