Lately, I’ve been reading The Pragmatic Programmer. The book is alright. If anything it helps bring more structure to my programming knowledge. Although, some of the stuff I’ve already learned through my own experience and so it seems kind of obvious. I must say that the book takes some liberties in the naming of programming concepts.
Anyways, I was reading today the section entitled “Programming by Coincidence” and here is an except:
“Suppose Fred is given a programming assignment. Fred types in some code, tries it, and it seems to work. Fred types in some more code, tries it, and it still seems to work. After several weeks of coding this way, the program suddenly stops working, and after hours of trying to fix it, he still doesn’t know why. Fred may well spend a significant amount of time chasing this piece of code around without ever being able to fix it. No matter what he does, it just doesn’t ever seem to work right.”
One thing that I know is that in order to be a good programmer you have to be persistent when it comes to tracking down and fixing bugs. In the paragraph above, Fred spends several weeks working on code, but yet he gives up after several hours and calls it quits? Bugs can be fixed, if you spend enough time fixing them. The problem with Fred is that he is a script kiddy. He wants something for nothing and is not willing to work hard to fix his mistakes. Obviously he needs to spend a more significant amount of time trying to fix it, because given enough time, it can be done. I’ve spent days debugging and fixing bugs. Sounds to me like Fred is a wuss.
There is another section called “Refactoring” that states that gardening is a better metaphor for software development than building construction because building construction doesn’t take into account refactoring.
Unfortunately the most common metaphor for software development is building construction. But using construction as the guiding metaphor implies these steps:
1. An architect draws up blueprints
2. Contractors dig out the foundation, build the superstructure, wire and plumb, and apply finishing touches.
3. The tenants move in and live happily ever after, calling building maintenance to fix any problems.
Well software doesn’t quite work that way. Rather than construction, software is more like gardening - it is more organic than concrete.
The authors of the book got this one wrong because they didn’t fully evaluate the building construction metaphor. They imply that the building construction metaphor only includes the building’s initial construction and after it’s initial construction it has been built perfectly without flaw. While a lot of the work is complete after a building’s initial construction it does not mean that remodeling or reconstruction won’t take place further down the road, especially if their were errors in the building’s initial design. So the remodeling of the building, or the gutting of electrical or plumbing, does in fact take into account the refactoring aspect of programming. Because the authors only considered the building construction metaphor within a short timespan, they completely miss the fact that the building could be totally remodeled 20 years down the road — refactoring! Let me also say that I’ve never heard the word “development” from the term “software development” being used in conjunction with the work of a gardener. Maybe a landscape developer, but a landscape developer is more of an architect than a developer. Nevertheless if anybody wants to be a software developer that is liken to a gardener, that is completely your gay wish. But as for me, I rather my work to be likened to the construction of a building.
Toward the end of the book, it tends to repeat itself, by trying to explain the same thing 10,000 different ways. Talk about DRY (Don’t Repeat Yourself)!