Posts tagged with ‘code complete’
-
Structure over Flexibility
From February 25, 2010 @ 8:35 am
At one time or another, someone thought that each of the following control structures was a good idea:
…
- Ability to have the program generate code on the fly and then execute the code it just wrote.
…
At one time, each of these ideas was regarded as acceptable or even desirable, even though now they all look hopelessly quaint, outdated, or dangerous. The field of software development has advanced largely through _restricting_ what programmers can do with their code. Consequently, I view unconventional control structures with strong skepticism. I suspect that the majority of constructs in this chapter will eventually find their way onto the programmer’s scrap heap along with computed _goto_ labels, variable routine entry points, _self-modifying code_, and other structures that _favored flexibility and convenience over structure and the ability to manage complexity. – Steve McConnell. Code Complete 2e
I guess Mr. McConnell isn’t too much of a fan of Lisp. Especially considering that everything he finds wrong with these strange control structures seem to be what Yegge and The Wizards seem to appreciate about the language, although I suppose that Lispers would argue that their language allows them to be far more expressive and semantic about what the crazy things they invent to solve their unique problems are than crummy goto statements…
-
That’s the trouble with falling in love.
From February 01, 2010 @ 12:54 pm
Try as many ideas as you can in pseudocode before you start coding. Once you start coding, you get emotionally involved with your code and it becomes harder to throw away a bad design and start over. – Steve McConnell
I love this quote. I’m amazed every time I do anything how sold I get to the way that I started doing it. Just this past week I was working on a problem and I began in a certain way without too much thought up front. 3/4 of my way into the day with almost no progress having been made, I was still hacking away at the same solution, convinced that I was just too close to the problem or just another half a dozen lines of code away from solving it. What I should have done is stopped 2 hours into it and said, “This isn’t working. I can’t see why it should be this complicated. It must be the ’solution’ I came up with. Reset.”
This works in other areas of life as well. Taking the time to do a little analysis and design up front can save you boatloads of time and frustration, not just because you shouldn’t make as many mistakes during the actual implementation of whatever adventure you’re going on, but because it really is hard to give up on something once you feel committed to it.
This is probably why most people are still at the jobs they are.
