Last month, I attended Sandi Metz’s three-day Practical Object-Oriented Design Course in Durham, NC. The course totally exceeded my high expectations. I felt very lucky and glad that I decided to go. It was one of the best things that happened to me this year.
In this post, I will share:
- why I decided to make this big investment
- what happened in those three days
- what happened after the course
- how can you learn these course materials
1. Why I decided to spend time and ??? on this course
I first knew about Sandi Metz through her book Practical Object-Oriented Design in Ruby. When I was reading the book, I felt joy overflowing from the bottom of my heart. I’m serious and not exaggerating at all. The book explains concepts clearly and beautifully, like a poem.
There were feelings related to programming I couldn’t explain nor put into words. In many places of the book, Sandi gently laid them out, dissected them, and showed me what they were about as if she was reading my mind and speaking to me directly. It made me wanted to shout out: “Yes! That’s exactly how I felt! How did you know?! Finally, someone understood me!”
One of those moments I felt being understood:
"when it becomes painful it is a sign that we believe we could, and should, be doing more." – Sandi Metz.
Can not agree more. pic.twitter.com/ADlI6ke7tp
— Sihui Huang (@sihui_io) June 8, 2017
Since then, I started to follow Sandi and watched many of her talks and got blown away repeatedly.
I was lost and struggling.
I was eager to become a productive developer who writes clean, beautiful, and well-thought-out code by which I could be proud of. I kept learning: reading books, watching talks, and seeking advice from senior developers. But my code became worse. Every time I put my hands on the keyboard, objections started appearing in my head: “you should use a factory”, “you are violating the Law of Demeter”, “the test set up is too long, something is wrong”…
I wasn’t certain if I indeed understood what I read. There was a big gap between theories in my head and applying them to daily work. I had a rough idea about how the code should look like in the end, but I didn’t know how to get there. I wrote code slower, and my code was harder to understand. I was frustrated and lost.
The public course was open.
As I was struggling and feeling lost, I noticed Sandi Metz was offering her three-day Practical Object-Oriented Design Course to the public. The course was expensive ???. Maximizing the personal learning budget offered by my company, I still needed to pay a significant amount myself.
Eventually, I decided to give the course a try. My confusion and frustration had been causing me so much pain that I would be willing to pay almost any price to get my head sorted out. And if even Sandi couldn’t help me with it, probably few people on earth could.
I was very glad I decided to go.
At the end of the second day of the course, I felt deeply grateful and lucky that I decided to attend. I agreed with every word in from the above testimonies. If the price was doubled, the course would still be well worth it and I would still run for it.
2. What happened in those three days
The course was very hands-on and interactive. The first half of the course was mostly based on materials from Sandi’s 99 Bottles of OOP. We were asked to read the book before coming to the course in order to have more in-depth discussions and exercises.
Thinking-out-loud with Sandi Metz
The whole class would walk through an exercise together in a thinking-out-loud fashion with Sandi. Instead of lecturing, Sandi would keep asking us questions to provoke our thoughts and guide us. She would keep repeating the principles and rules we stand by again and again under different contexts to help us gain a deeper understanding and make them stick with us. She showed us how she approached a problem by thinking out loud and showing us her thought process step-by-step. During the process, we got to ask her to expand her thoughts on specific steps and explain why she would prefer one way over the other.
Peer-to-peer Pair Programming
After each small exercise, students would pair program with each other and walk through the same exercise again. When we paired, we explained to each other the reasoning behind each step: why we were rearranging code this way, what were we trying to achieve, and so on. It was a great way to reinforce what we just learned.
After pair programming, the class would move on to the next exercise and repeat the thinking-out-loud-with-Sandi step as a whole.
The exercises were very well-designed and thought-out. Each of them encapsulated specific topics Sandi wanted to walk us through. They were built on top of each other and were ordered according to the order those topics should appear. For example, the first exercise demonstrated what Shameless Green Code meant (Chapter 2 of the 99 Bottle book) and later exercises demonstrated how to apply the Flocking Rules (Chapter 3.6of the 99 Bottle book).
The Framework we followed
The first half of the course focuses on the foundation of OOD and a process that produces object-oriented code. The process can be summarized as: start with the “shameless green” version of your code, follow the flocking rules to horizontally refactor your class until it’s open to the new requirement. (more on this on the suggestion section)
In the beginning of the second and third days, students would form groups of six randomly and come up with five-minute presentations on any topic they learned from the previous day. Presentations could be in any format. Many of us came up with mini-skits.
As silly as it might sound, it turned out to be a very effective way of learning. While preparing for presentations, students had to think through the topics they learned from the previous day and pick the ones to talk about as a group. Watching other students’ presentations not only helped us review the materials but also provided us different perspectives. The step combined three of the most effective ways of learning: learn by retrieving and reflecting, learn by teaching, and peer-to-peer learning.
In the second day of the course, students again formed groups of six randomly where each group got assigned a principle from the S.O.L.I.D design principles and needed to make a presentation about it.
The second half of the course
While the first half of the course showed how code could look like in a perfect world and presented a vision every developer dream of, the second half of the course focused on tactics for dealing with real-world bananas. This way, we could gradually and pragmatically move our current codebase towards the vision we wanted.
Key concepts include: decoupling from an external framework, Sandi’s rules for dealing with Rails, and how to make your codebase better in day-to-day work.
In the last afternoon of the course, students paired to walk through a brand new exercise that covered all the topics.
3. What happened after the course
Went to the class with a brand new notebook, came back with tones of notes, a clearer mind, and a deeper understanding of OO Design. ☀️🍼 pic.twitter.com/5rs1zTsN1g
— Sihui Huang (@sihui_io) October 30, 2017
I gained clarity.
Many things clicked. I knew what well-designed code should look like. It should be telling stories about your business domain. It shouldn’t require the reader to think hard in order to figure out how it works. It should be understandable even if the reader is a bit drunk. I learned how to write well-designed code: start with the shameless green version, follow the flocking rules, and use code smells and the new requirements as guidance. I knew the difference between procedure code and object-oriented code: procedure code writes out lists of instructions with millions of conditionals whereas object-oriented code picks the right object and just let it behaves.
The end of the course was the beginning of the next journey.
In the end of the course, Sandi said her goals of the course was to show us how OO code should look like, show us how it could be done, make us want it, and convince us we could write it ourselves. She succeeded in all of her goals. We were not done after the course. Sandi gave us homework to continue learning and practicing the techniques we learned. We were asked to study a code smell per week and set aside specific time to practice refactoring and following the flocking rules.
Time for the real world
Equipped with all the new knowledge, I am eager to apply what I learned to my day-to-day work. Honestly, it’s challenging. Our five-year-old codebase is far more complicated than the well-designed exercise we had in class. And I don’t have Sandi by my side anymore. I could use some of the techniques already, but mastering all of them so that I can apply them to our code base takes time, patience, and dedicated efforts.
My next steps are to:
- do the homework Sandi gave us
- keep sharing what I learned with different engineers to get my ideas challenged and discover any misunderstanding I have
- start using the process and framework we learned at work
I will share my learnings along the way. Subscribe if you are interested!
4. How can you learn these course materials
For those of you who experienced the pain I described in section 1, here are my suggestions.
If you can go to a public or private course, I wholeheartedly second the testimony that says: “Run, don’t walk, and throw money at Sandi now!”
If that’s not an option for you at the moment, get a copy of Sandi’s 99 Bottles of OOP. Most concepts and materials of the first half of the course were in the book. I strongly encourage you to read the book and work through the exercise carefully. The most important element missing from the book is that you don’t have Sandi repeatedly shouting out these concepts to your ear over and over again.
I read the book before the course and many of its words seemed either obvious or light-weighted so I thought I got it while I didn’t. Because Sandi kept repeating them, emphasizing them, and rephrasing them again and again, I realized how important and powerful they were. There were many moments after Sandi repeated the same phase for the tenth times under different contexts, it actually “clicked” in my head: “Oh wow, so that’s what she actually meant! How come I didn’t see it before!? That’s literally what she has been saying!”
So read the book carefully and try to take her words literally. As you read, ask yourself why Sandi made these suggestions. Each concept she introduced in the book, as brief as just one paragraph, could be very powerful and priceless.
Relative talks from Sandi:
- prefer duplication over the wrong abstraction
- reach for open / closed
- nothing is something (don’t fall for nil checking)
- dependency injection
- composition over inheritance
Want to see how I apply my learnings from the course to work?
I will periodically share insights I gain as I apply these lessons to day-to-day work. Subscribe if you are interested!
Special thanks to Sandi and our teaching assistant TJ Stankus for putting so many thoughts and love into the course and to my company, Gusto, for supporting me keep learning.