Friday, 14 October 2011

The Clean Coder & Apprenticeship Patterns

I'm speaking next week at ScanDev on Tour in Stockholm on the subject of "Software Development Craftsmanship", and as part of my research I read both "The Clean Coder" by Robert C. Martin and "Apprenticeship Patterns" by Dave Hoover & Adewale Oshineye. These are very different books, but both aimed at less experienced software developers who want to learn about what it means to be a professional in the field. In this article I'd like to review them side by side. First some text from each preface on what the authors think the books are about:

Apprenticeship Patterns

"This book should help you through the tough decisions you face as a newcomer to the field of professional software development. " (preface xi)

The Clean Coder

"This book is about software professionalism. It contains a lot of pragmatic advice" (preface xxii)

The Content
Both books contain a lot of personal stories and anecdotes from the authors' careers, and begin with a short autobiography. Some of the advice is also similar. Both advise you to practice with "Kata" exercises, to read widely and to find suitable mentors. I think that's mostly where the similarities end though.
 
Dave and Ade don't say much about how to handle unreasonable managers imposing impossible deadlines. Bob Martin devotes a several chapters to this kind of issue, handling pressure, time management, estimation, making committments etc.

Dave and Ade talk more about how to get yourself into situations optimized for learning and progress in your career. They advise you to "Be the worst", "Find mentors", seek "Kindred Spirits". In other words, join a team where you're the least skilled but you'll be taught, look for mentors in many places, and get involved in the community.

Bob talks about a lot of specific practices and has detailed advice. He mentions "... pairing is the most efficient way to solve a problem" (p164) Later in the chapter he suggests the optimal composition of job roles in a gelled team. (p169) He also has some advice about how to successfully argue with your boss and go over their head when necessary (p35).

The Advice
Those few example perhaps illustrate that these two books are miles apart when it comes to writing style, approach and world view. Dave&Ade have clearly spent a lot of time talking with other professionals about their material, acting on feedback and testing their ideas for validity in real situations. The book is highly collaborative and while full of advice, is not prescriptive.

Bob Martin on the other hand loves to be specific, provocative and extreme in his advice. "QA should find nothing."(p114) "You should plan on working 60 hours per week." (p16) "Avoid the Zone." (p62) "The jury is in! ... TDD works" (p79) These are some of his more suprising pieces of advice, which I think are actually fairly doubtful propositions when taken to extremes like this. Mixed in are more reasonable statements. "You do not have to attend every meeting to which you are invited" (p123) "The professional developer is calm and decisive under pressure". (p150)

The way everything is presented as black-and-white, do-or-do-not-there-is-no-try is actually pretty wearing after a while. He does it to try to make you think, as a rhetorical device, to promote healthy discussion. I think it all too easily leads the reader to throw the baby out with the bathwater. I can't accept one of his recommendations, so I throw them all out.

Some of Dave&Ade's advice is actually just as hard to put into practice. Each of their patterns is followed by a call to action. Things like re-implementing a program you've written in an imperative language in a functional language (p21). Join or start a user group (p65). Solve the same coding exercise once a week for the next four weeks (p79). None of these things is particularly easy to do, but they seem to me to be interesting and useful challenges.


Collaboration
Bob has also clearly not collaborated very widely when preparing his material. One part that particularly sticks out for me is a footnote on page 75:

"I had a wonderful conversation with @desi (Desi McAdam, founder of DevChix) about what motivates women programmers. I told her that when I got a program working, it was like slaying the great beast. She told me that for her and other women she had spoken to, the act of writing code was an act of nurturing creation." (footnote, p75)

Has he ever actually run his "programming is slaying a great beast" thing past any other male programmers? Let me qualify that - non-fantasy-role-playing male programmers? Thought not. This is in enormous contrast to Dave&Ade, whose book is full of stories from other people backing up their claims.

Stories
Bob's book is full of stories from his own career, and he is very honest and open about his failures. This is a very brave thing to do, and I have a great deal of respect for him for doing so. It's also really interesting to hear about the history of what life was like when computers filled a room and people used punch cards to program them. Dave&Ades stories are less compelling and not always as well written.
 
Bob's book is not just about his professional life, he shares his likes and dislikes. He reccommends cycling or walking to recharge your energy, or "focus-manna" as he calls it, (p127). Reading science fiction as a cure for writer's block. (p66) Listening to "The Wall" while coding could be bad for your design. (p63) When describing "Master" programmers he likens them to Scotty from Star Trek. (p182)

All this is very cute and gives you a more rounded picture of what software professionalism is about. Maybe. Actually it really puts me off the idea. I know a lot of software developers like science fiction and fantasy role playing, but it really isn't mandatory. He usually says that you may have other preferences, and you don't have to do like he does, but I just don't think it helps all that much. The rest of the book is highly dogmatic about what you should and shouldn't do, and it kind of rubs off.

Conclusions
The bottom line is, I wouldn't reccommend "The Clean Coder" to any young inexperienced software developer, particularly not if she were a woman. There is too much of it written from a foreign culture, in a demanding tone, propounding overly extreme behaviour. The interesting stories and good pieces of advice are drowned out.


On the other hand, I would recommend "Apprenticeship Patterns". I think it is humbly written and anchored in real experience from a range of people. I agree with them when they say you need to read it twice to understand it. The first time to get an overview, the second time to understand how the patterns connect. It's not as easy to read as it might be. But still, I think the content is interesting, and it gives a good introduction to what being a professional software craftsman is about, and how to get there.

12 comments:

  1. Awesome article! Keep it up, will follow the lead. :)

    ___
    International calls

    ReplyDelete
  2. Emily,
    Thanks for the detailed comparison!
    I love reviews which reduce my to-read list:-)
    Will get the other one, hadn't heard of it.
    Take care
    Olaf

    ReplyDelete
  3. Likewise. This is a really valuable review post, many thanks I will certainly consider altering my shopping list based on this.

    ReplyDelete
  4. Thanks for your comments! I was pretty nervous criticising Bob Martin in public like this, I'm really pleased with the thoughtful reception. I hope "Apprenticeship Patterns" reaches a wider audience.

    ReplyDelete
  5. Emily, an oddly B&W prescription for a review that purports to dislike B&W prescriptions.

    Actually, I was very flattered by the kind words you wrote about the Clean Coder. I think people who read the review will be more likely to read _both_ books and that your final recommendation will disuade no one.

    Some times the best way to make a point, is to make the point, and not quibble over it. As you found in the conclusion of your review, you can only type YMMV so many times.

    ReplyDelete
  6. Good review. Uncle Bob is quite deliberate in his delivery, but I need that in a text so there is no confusion about the points being made.

    Honestly, I never give women in programming a thought. The ones I interact with are so very good, they are just one of the team.

    As to apprenticeship, I've been hearing that a lot lately. And I disagree with the concept completely.

    My preference for the industry would be personal coaches. Not mentors, mind you -- coaches. As in sports, a coach is meant to tell you plainly what you are doing wrong and how to correct it.

    While a mentor may be great for navigating the political steps in a given corporation, what the fresh young minds need is an honest evaluation of how they are doing at what they are doing. Bob is pretty good at that, in my opinion.

    Re's

    Glenn

    ReplyDelete
  7. While I find it entertaining to read book reviews from other people, I hardly ever get any value from them because all too many factors come into play when you review someone else's work that keeping it 100% objective is the hardest thing to do.

    I'd rather you pick a few points from both books and debate about them (and invite others to join the debate) than only list the things you didn't like.

    But hey! Thanks for taking the time to share with the rest of us!

    ReplyDelete
  8. Bob - I'm surprised you find my review black and white. I thought I had avoided presenting one book as perfect and the other as terrible. I do express a clear preference for one over the other in my conclusion, but I don't think I took up the kind of extreme position that I criticise you for.

    Glenn - I think the footnote I refer in the article to reflects more about Bob's preferences than any fundamental difference between male and female programmers. Reading it made me wonder how much of the rest of the book reflects the attitudes and values of one man rather than the opinions of a programming community.

    I also think "Apprenticeship patterns" offers clear advice, and encourages you to seek people who will clearly coach and correct you, as well as people who will mentor you. I don't see that you have to choose between the two.

    ReplyDelete
  9. Alfredo - I don't claim to be objective. These are my subjective opinions. I don't agree with your assessment that I only listed things I didn't like, or that I am not willing to debate.

    ReplyDelete
  10. Glenn, what is it about apprenticeship that you disagree with so completely? Bob and I both believe strongly in apprenticeship.

    ReplyDelete
  11. Emily, unfortunately the posting software left out the <grin> following the first sentence of my comment. It thought it was an html tag. I'm getting better at remembering to use &lt; <grin>

    I quite agree that the review itself was balanced and fair and not at all B&W. The recommendation at the end, however, was entirely B&W. Once you stopped reporting and started to advise you expressed your B&W opinion; which is exactly what you should do when you are advising. <grin>

    ReplyDelete
  12. Bob - I thought your comment was a bit harsh! I feel better now.

    ReplyDelete