Friday, 21 March 2008

The joys of craft

Since I started learning to program in 1998 (yes, I was not a kid of 13 playing with his commodore 64, on the contrary I was a rather mature man of 30 who had barely seen a pc before and thought that Win95 was sort of a prodige), I've read in programming books that code reuse is generally a good thing. Indeed, this was confirmed by my successive years of experience in the world of professional programming. Now, to prove that I have acquired one of the most distinctive mental habits of this trade, I'm going to show you maybe the most common and primitive form of code reuse, that is copy & paste, applied to this very post. I've often thought about the joys of programming and have come up with some answers. Last night, while browsing, I began reading an excerpt from a book I'm told is a classical for us programmers and which it's on my wish list for some time now, "The mythical man-month" by Frederick P. Brooks. Well, in a paragraph called "The joys of craft", Brooks expresses my feelings about programming in such an accurate way, that it's really not worth bothering reformulating them in my own words. So here we go, let's copy and paste.

"Why is programming fun? What delights may its practitioner expect as his reward?
First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.
Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child's first clay pencil holder "for Daddy's office."
Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine or the jukebox mechanism, carried to the ultimate.
Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. In one way or another the problem is ever new, and its solver learns something: sometimes practical, sometimes theoretical, and sometimes both.
Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. (As we shall see later, this very tractability has its own problems.)
Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.
Programming then is fun because it gratifies creative longings built deep within us and delights sensibilities we have in common with all men."