On pretty-boy programmers
A few days ago Spolsky, the software guru, wrote an interesting article about star programmers at work. The article highlights the importance of the KISS principle and how important is to avoid the corners of the platforms and programming languages (he repeatedly mentions how bad multiple inheritance is, and how hard certain technologies like COM and CORBA turn out to be).
I agree with his view but, unless I've lost the point, I find it dangerous (and it seems I'm not the only one) since the described ideas are only applicable for experts. I mean, saying things like bypassing unit testing is ok or XORing pointers is what rock-star programmers do, can at least confuse entry-level developers. In fact it heavily reminds me the lonesome programmer style described in several books and writings as something to avoid (if I remember correctly I think it was already mentioned in "The mythical man-month", at least some well-known agile books and for some reason I think at the "Goto- Sofware superheroes" book too). The kind of wild-guy who knows what to do, hates the rules, loves the "old-style" and so on. Spolsky calls them "pretty-boys". Funny.
Of course, Spolsky is right. Let me explain.
The best explanation I've read on the subject is "Pragmatic learning and thinking" by the pragmatic Andy Hunt. In chapter, titled "Journey from novice to expert", he explains the 5 stages in Dreyfus model:
- Advanced beginner
and how experts rely on intuition while novices need clear rules to follow. In fact there's a good explanation about why an expert can't always exactly explain why something is ok and some other choice (for instance a way to code a method) is totally wrong, but they know it. The answer is that their knowledge is so deeply wired into their brains they don't really know why they know it, but they do. An extended explanation about linear mode and rich mode brain is also included (where linear is the rational part of the brain and rich is the artistic, non-verbal and highly imaginative one).
It is also interesting to know that most of the people on a certain activity (including programming) are at the advanced beginners level, and no matter how long they've been there, if they don't put the right pieces in place, they'll stay there forever. So, reaching the exceptional expert level is not a matter of time (as commonly thought) but a combination of skills, effort and following the right steps. Being able to move forward is not easy.
Why am I writing this? Well, I think the "pretty boy" programmers Joel Spolsky mentions are clearly gifted experts or at least proficient programmers. A different rule set is applied for these individuals. Once you master the subject, you're somehow allowed to break the rules, but not before
Let me explain with a simple example: many of us were taught back at the university that goto sentences were evil. Never use them! But then, later, you find out that it's not that bad to put gotos on your C code to place cleanup code (my all times favorite Code Complete includes an excellent explanation). So, which one is right? Mr. McConnell or your old programming professor? Both. A newbie (novice according to Dreyfus model) needs clear rules to follow. Don't write gotos is a clear one. Then you learn the entire thing, and understand some of the rules can be bent.
And the same is true for unit testing under high pressure, using weird pointer arithmetic and so on. But you have to master the basic first, which sometimes will take a lifetime.