I’ve been lucky enough to spend the past two days in the presence of Robert C. Martin a.k.a. Uncle Bob for his Clean Code workshop at Skills Matter in London. I arrived at the very last-minute having decided to try out a Santander Cycle for the first time, only to discover that the promised docking station next to Code Node has disappeared under road works.
The workshop got off to a slow start as we spent over an hour going round the room indicating how long we’d been programming and what languages we’d used. This seemed to be just so that we could observe that, as well as a fair smattering of those in the first 5-10 years, there were many of us beyond our first flush of youth! That, and so that Bob could provide a potted history of various programming languages. This was a general theme for the course with Bob prefixing each module with an interlude on some aspect or other of astro or nuclear physics!
As a consequence of the above, if attendees were expecting to learn all of the content of the Clean Code book during the workshop then they’d leave disappointed. (Although a copy of the book was included in the exorbitant course fee.) What you did get was a good understanding of the values that underlie the practices covered by the book, the opportunity to watch the master at work refactoring and plenty of opportunity to ask questions first-hand.
I shan’t attempt to repeat the material but there were two main a-ha moments for me. The first was that, as a result of not doing test-first development, we’ve ended up with unit tests focused on each individual method. This has made them extremely fragile to refactoring which, in turn, means that either the tests quickly fall by the wayside or that refactoring just doesn’t happen. And that leads to the second learning point: to refactor mercilessly, extracting functions until every function does just one thing. I had fallen in to the trap of seeing the myriad of small methods as adding to the complexity. Bob’s argument is that, well-named, the methods allow you to quickly gained an understanding of what the code is doing at every level of abstraction. Based on the one exercise that we did during the workshop, I’d say that pairing is immensely helpful in determining what makes a good name. Anyway, lots to share back with my colleagues!
As an aside: I can heartily recommend the Hawksmoor Seven Dials if you are a fan of steak (although it has to be said that the corporate expense limit would have just about covered the meat on my plate!).