How to be a better programmer – the redux part 2
“Most programmers have only a vague notion of how competent they are at what they do for a living” — Steve Yegge
“Experience comes from practice” — Andy Hunt
I thought I was done and dusted having wrote that previous redux post about how to be a better programmer. But my good friend Subru had posted a comment that made me (as it does most of the time) take notice and do some thinking and research about the importance of study and practice in the career of programmers. I did that since it has a direct impact on the topic I have been harping about — the talent of the programmers like me, or the lack of it.
Subru had wrote that reading a few books need not necessarily make you better. He said that observing and interacting with senior craftsmen would make you a better programmer. It is precisely this attitude and observation that I wanted to do some thinking about. I, based on my personal experience, believe that it is better to read the books than observing the masters. The reason being that you never know whether the maestro is actually doing the right thing or more importantly, it is the right thing for you at the stage or phase of your learning or career. Plus, what if the meastro hasn’t read anything in the recent past and so is not in touch with the latest developments in the field?
I had this doubt, nay, conviction, partly because I had the good fortune of reading about Shu Ha Ri which was an appendix of the great Alistair Cockburn book Agile Software Development: the Co-operative Game, and partly because I believe Subru was wrong about the books. Shu Ha Ri teaches you that a beginner (the Shu phase) needs a framework or a rigid set of rules to follow, plus constant feedback to get through the initial learning phase. In the intermediate level (the Ha phase) one masters the rules, and learns all the tricks of the trade. In the advanced phase (the Ri phase) one needs to actually forget the rules or transcend the rules and make one’s own rules of the game.
Ok, so what am I harping about here? Well, just the fact that with practice anyone (who is not physically or mentally invalidated to even attempt the task at hand) can move from being a novice to a master. All it takes is dedication and some knowledge of how to travel the path of mastery. I am not saying this. Hear it in Kathy Sierra’s (of the Head First Java and Head First Design Patterns fame) words here. Having experienced first hand how Apple and myself could actually become far better programmers than what we were when we started out, I can vouch for it. I am not talking about the linear progression in talent that people who don’t read books enjoy. In our case, the progression was non-linear, if not exponential, and it was made possible by the simple fact that we studied (read) and we practiced what we studied — him probably more than me.
In fact some of the best minds in our industry believe what Kathy was conveying passionately. Steve Yeggey, one of the best bloggers I have read, has analyzed this topic in-depth, and later came up with an article titled “Practicing Programming” for people like you and me (the average programmer) to reflect upon and work upon to becoming a better programmer. He wrote both the articles a few years back when he was still with Amazon, and now he is with Google.
He writes in the first essay:
Bob (our average programmer) knows this guy Joe who’s just amazing. Joe’s like the best programmer Bob’s ever known…He’s a natural at it. One of them whiz kids…
In Bob’s view of the world, there are essentially three programmer skill levels: folks learning how to program, folks like Bob who know how to program, and the inevitable whizzes, but they’re few and far between. There are always a few whizzes out there, the ones who used to be child geniuses or whatever…
Bob has no incentive whatsoever to try to improve his skills: He knows he’s not as good as Joe. But Joe’s great on account of his genes, not because he practiced or studied more than Bob did, back in school. Obviously Bob can’t compete with people who were kid geniuses, and he shouldn’t exert himself unduly on their account.
It is a great rant and a rich source of stuff for us to reflect upon. At least I came back knowing more about myself and realizing I had been that Bob at many a time, and probably still am a Bob in many ways.
This is reinforced by the works of two authors I respect very highly — Andy Hunt and Dave Thomas (of the Pragmatic Programmer fame). Dave, for instance, thought deeply about the importance of study and practice. He went on to devised a set of exercises, named Code Kata, for exerting the programmer’s brain — stuff for us to chew upon to become better at what we do. And finally, here is his take on the various phases of learning and skill acquisition which is similar to the Shu Ha Ri theory, but based on the art of karate.
Of course, the real spark for this article was this great post by Jeff Atwood: “Programming: Love It or Leave It” earlier this week. From there the trail of reading (thanks to Google) led me to this rather controversial article about how to become a better programmer by not programming. I don’t think, for once, the author is 100% right. Yes, Bill Gates is right, but the point is people can improve and many people really do. As Kathy says, of course, that won’t be enough to be the gold medal winner at the Olympics, but we can be the street, council, district, state or national champions, at least.
So, the point is, IMHO, it is a far safer better to depend on books rather than trying to observe a mentor, for the simple fact that at least I have bumped into only a handful of people in India in eight years from whom I could learn something about programming. Of course there are lots of people to observe and learn about people management and the art of maintaining relationships or soft skills, but that is beside the point of this post. I accept that perhaps I am not good enough to have worked at a Google or a Microsoft, or that I was perhaps exceptionally unlucky (not to have bumped into more mentors) but the point is 90% of the software developers are not working at Google or Microsoft either. And people like me too have a right — and a duty — to improve, right?
As Peter Norvig says in the article Teach Yourself Programming in 10 years, to be really good at anything including programming requires lots of time, effort and dedication, and more importantly, we all know that if the pioneers of the Design Patterns movement hadn’t read Christopher Alexander’s work(s) on architecture, there probably would have been no Design Patterns movement. And if I hadn’t read those great books or those great blogs, there wouldn’t have been this post either!
Apple implants the programming virus in my brain
Also, I wouldn’t have started my journey of becoming better had my good friend Apple not read the K&R book and made me both feel small and admire his skills when he wrote this sometime in 1999 in my notebook:
while (*t++ = *s++);
That, for the uninitiated, is the succint way of copying a source character array into a target character array in C. Apple wrote this after asking me to write a program to copy an array, and the best I could think of was to write half a dozen lines or so to achieve the same, and without using pointers. That was the moment when my journey to get better actually started. Even after that moment, I was the guy who did his C++ project in C (at NIIT), since I couldn’t quite understand what this fuss about using objects was all about (and I was good at C thanks to the K&R book)! And it required reading The C++ Programming Language by Bjarne Stroustrup in 2000 to make me see the light, at last, and luckily, I never turned my back at lapping up a great programming book since then!
To wrap up, I would rather continue reading than either sitting idle or just (waiting for and) watching the right mentor. And I would ask every developer interested in becoming better to do the same.
Oh, and yes, lest I forget…Happy new year and thanks for reading yet another long post!