A weekend with Sandi Metz

We can consider the Kool-Aid well and truly drunk. Having spent the weekend listening to many of Sandi’s lectures I now understand why everyone talks so highly of her. Watching the power that following SOLID design principals could have was truly enlightening, and her 5 rules for developers are as wonderfully interesting as they are useful.

Sandi Metz’s 5 rules

It’s impressive how quickly it all starts to sink in. When working through this weeks task of creating a pseudo-oystercard program, every time I was about to commit a faux pas I would hear her voice in my head telling me I was making a mistake. I had a sense of knowing where everything belonged, it felt very natural breaking things down into their behaviours. When Sandi says that having repeated suffixes/prefixes tells you there is a class screaming to get out, it really is like that, you can hear that something is wrong.

To finish off I will give you an example, one of the principals of SOLID is Single responsibility principle (the ‘S’ to be specific). This means objects should have only one responsibility. Sandi often talks about breaking long procedures into small methods that do specific things. Today we had the task of adding a journey history feature that stored the entry/exit station in a hash. Now I could have implemented it right inside the swipe_in and swipe_out methods however I knew that felt wrong. I was giving swipe_in/out more roles than it needed and that a store_history method that swipe_out could call was a far better implementation.

I hope to write a few more blog posts about makers and life as a whole however at the moment I find writing about all what I've learnt to be very useful in solidifying ideas and allowing me the opportunity to put them into words, even if some of them are stolen.