Or: The process of programming
Programming is in many aspects similar to any other art... painting for example. Anyone can create a picture, but only few pictures are good. And it takes tremendous amounts of training, talent or both until one can draw a first picture that can be called a masterpiece.
But unlike drawing, you don't see the quality of a program just by looking at the surface. If a program works, it makes no difference whether it was done nicely or not, at least not to the user. You need the source code to tell, and the source is highly treasured by any programmer, especially those who need to sell the program to pay their bills.
Badly written programs, or programs based on a flawed design, are doomed because nobody but the author himself can or wants to maintain the program, add new features or remove bugs. In some cases, when the code is just bad enough, not even the author will understand the code any more. If the program design (the way the source code is structured) was not carefully planned ahead from the beginning, it is almost guaranteed that the design is flawed. Some bugs might turn out to be impossible to fix, the addition of features usually turns out to be a tremendous amount of work.
Most programs are badly done, for example the text editor I'm writing this text in (notepad). And most program designs are fundamentally flawed, even those written by masters.
This can be explained easily... it boils down to: good programming is very, very difficult, it requires a lot of experience and very much time. Unfortunately, one can gain experience only by making mistakes, which is one of the reasons for the large amount of bad programs. An other reason is that good programming requires a lot of time, and if you are a company that needs to produce something to sell - you usually have to do it quickly.
The programming itself could be compared to a surgery. Depending on the complexity of the operation, a doctor needs different levels of concentration to get the job done. But irregardless of the complexity, the doctor has to focus on the operation, and on the operation alone. He cannot watch TV or knit a pair of socks or talk on the phone while he is doing the operation. Maybe he can listen to some music, but that's about it. Programming is very similar. There are different tasks for a programmer, with different difficulties and complexities involved. The more complex a task, the more concentration you need to get it done. The easy parts require almost no concentration at all, but they are usually quite dull. The fun part is the one that requires a good amount of zen meditation to get it done. That's the stuff we're after.
I can say from experience that when I'm programming a difficult part of a system, I need to accumulate a tremendous amount of concentration. You could say it is a form of trance, it really is. Usually I listen to some form of electronic music with no text, no vocals, lots of percussion... techno does it, or ambient music. Electronic stuff, usually. That has nothing to do with taste (but of course, liking the music helps) - the music serves a special purpose: block out the world, so that I can get into this state of mind. Usually I use headphones, at a deafening volume. I got special earplugs for precisely that purpose, plugs that cancel outside noise, they come with a rubber plug and work wonders, even without tuning up the music. And usually I'm chewing on every pen within reach, which is why I'm always short of pens.
To maintain this state, I cannot allow any disturbance. I cannot work this way while on the desk next to me there is a discussion going on, a phone ringing or something else distracting my attention (the earplugs help with that). I also had to learn to ignore my phone if it is ringing, which is surprisingly difficult for most people. For the special state of mind, there must be just me and the program, nothing else. The rest of the world cannot exist, not even the cup of coffee that usually sits somewhere on my desk. I can maintain this state of mind for one or two hours straight, sometimes more. After that I need a break, something to eat or to drink, a bottle of water to splash around. During this time I can lower my defense and become available for the rest of the world, reading emails, team discussions, phone calls and stuff like that. After a while, I repeat the whole process. This works two, maybe three times a day, after that its impossible for me to accumulate enough concentration to enter that state of trance.
And that's the catch.
Entering this state of mind is the difficult part, maintaining it is easy - as long as I am not disturbed. But I cannot enter it as often as I'd like to.
Maintaining this state is only possible if there is no disturbance at all. During that time, I can get a huge amount of work done, have my best ideas, see ways to solve problems that would be hidden otherwise. But if you disturb me, even if it is just to ask the time, everything puffs in a cloud of smoke and is gone. So while I am programming, you either don't disturb me at all, or you disturb me for at least 15 minutes. There is nothing in between. And I tend to be pretty pissed if you do.
The result is that I have to plan ahead for a few hours when I need to get a programming job done, and that I have to make sure that I'm not disturbed during this time. I need to know in advance, otherwise I'll be checking for possible disturbances all the time, which makes real concentration impossible.
And believe it or not, after a day of concentration you are physically exhausted, unable to think more than about what to prepare for dinner.
Note: I wrote this text some time around 2002, when I was still a student of computer science. This is an almost exact copy of the original version, minus some typos.

No comments:
Post a Comment