I love Sandi
June 21, 2020
In my view, one of the most fundamental skills that a Software Developer needs to master is learning how to design simple systems.
Simple systems do just enough to accomplish what they were commissioned to do. They are very easy to understand. Each part of the system paints a clear picture of what role it fulfills in the grand scheme of things. In my fantasy, reading the code of a beautiful system is pleasurable. It will spare you from the fatigue you often experience from reading complex code. You will lose track of time because you are so immersed, consuming the beautiful art you are experiencing. When you see such a system, you will crave for more.
Simple systems age well. They effortlessly allow extensibility as business needs expand. It is not hard to build or grow them.
So, where do we find them?
Most systems are not simple. In my experience, simple systems are unicorns. Just like unicorns only found in cartoons, simple systems I’ve seen only exist in text books. Worse, some text books that I expected to show elegant simple systems fail to demonstrate them (e.g. Clean Code by Robert Martin).
If simple systems are unicorns, are we doomed to always build complex systems?
I don’t believe we are doomed (but then again, I am an optimist). I am convinced there is a solution to every problem, we just need to find it.
Fortunately, we can learn from others on this subject. There has been plenty of resources around that I’ve found helpful in building my intuition over time. In this post, I will be sharing some of my favourites from one of the people I admire in the software industry.
Sandi’s Brain
In order to build extensible and simple systems, we must learn what is a definition of simple system. In practice, these systems are highly cohesive and loosely coupled. What does those really mean? Sandi Metz has explored this topic extensively and have eloquently written and spoken on how to think about building such systems.
Practical Object-Oriented Design in Ruby
One of my favourite book is Practical Object-Oriented Design in Ruby. It is one of the books that I recommend by default to less experienced developers, and maybe even to seasoned developers. It is a really good book, walking you through how to develop intuition for what a well-defined Object Oriented programming looks like.
In FreshBooks, we’ve run book clubs with this book. Since we mostly code in Python at FreshBooks, we translated the examples from Ruby to Python to make it easier for participants to understand and engage in internalizing Sandi’s design tips. Our goal is to help developers apply the concepts in their day to day, moving from the theoretical text book examples to more practical experiences.
The Magic Tricks of Testing
One of the skills that will make a software developer super effective is learning how to test effectively. In my experience, knowing how to test immensely accelerates my development. With enough practice and good fundamental testing knowledge, you learn one of the truths in design - if your system is hard to test, it is usually a smell that your system is built poorly. The great thing about software is that it is software. We have all the power to change our destiny. With enough keystrokes, we can improve (or worsen) its implementation.
In Sandi’s talk - The Magic Tricks of Testing, she explains a simple mental model on how to think about testing. I highly recommend this to anyone. Often, I share this to people I code review when I find their test code overly complex. Smells include a lot of setup code and a mixed bag of assertion logic that make it very easy to get lost.
SOLID Object-Oriented Design
One of the popular acronyms in software is the SOLID Principles. There is a book written on this topic: Agile Software Development, Principles, Patterns, and Practices by Robert “Uncle Bob” Martin.
Uncle Bob is not my favourite author (nor speaker). Go watch some of his conference talks and you will notice he never finishes his topic.
While I’ve never read his book about SOLID, I have read his other two popular books - Clean Code, and Clean Architecture. I felt that his code in Clean Code is poorly written. I just couldn’t get past the aesthetics of his examples. I’ve briefly worked with Java in the past, and Uncle Bob’s code (at least in the book) was not great code or very pleasant to read. Clean Architecture on the other hand was tolerable from what I remember.
So, while I do believe in the SOLID Principles, I tend to spare budding super developers from what I feel are bad code examples. Instead, I direct them to a Sandi Metz talk on this topic - SOLID Object-Oriented Design. Bonus: instead of them spending a lot of hours powering through an awfully written book, Sandi’s video is much more time efficient (less than 45 minutes of her talk plus give or take an hour to reflect on how to apply it in day to day).
Get a Whiff of This
In Get a Whiff of This, Sandi gives us a primer on identifying code smells and also walks us through a bunch of strategies on how to fix them.
There is one bit in the talk that I really loved: just because the code is embarrassing, does not mean you should fix it. Her pragmatic approach to software development really shines as she shares ”It is fine to keep really embarrassing code. You should be brave about your ugly, embarrassing code because it is not costing you money if it is not changing“.
In my view, change should create value. A change could yield negative value (i.e. cost of change is less than the upside it brings). Practically speaking, we can spend three months refactoring a piece of code without much upside (save developers a few minutes) versus spending that same three months integrating with a partner that will bring in 10x more customers. In each scenario, we have to weigh the consequences of our choices. This is one of the harder lessons that developers need to internalize. These are one of those moments where I can see whether a developer has grown and developed a more senior mindset. When they are ready to translate their choices to many facets of software development realities and able to make well thought out choices, that is when I smile widely and excitely look forward to working with them more in the future.
Meet Sandi Metz
I’ve often read or heard that you need to find a mentor that will help you grow. I was lucky enough. Our late mom was a great mentor to both my siblings and me. I’ve also been blessed to find mentors (whether they know it or not) that help me understand the world a bit clearer. But mentors don’t just show up and drop knowledge on you. You have to find them and learn how to engage with them.
One of the tricks that I’ve learned over time is that you can find mentors anywhere. You can have mentors you’ve never met, as in the case of Sandi.
One day, I hope to meet Sandi. Until then, I will continue to share her wisdom with others. I hope this post encourages you to check out the content she has generously shared in the community.
Happy coding!