Building from the ground up: check early, check often
Posted Jan 19th, 2009 by David Calhoun in UncategorizedMaybe this comes as a no-brainer for a lot of you, but I’ve found that unless I’m super-comfortable with writing a bit of code I know will work, I find myself constantly checking it to make sure it’s working properly, each step of its journey to completion.
This constant checking of code may in passing resemble unit testing, but it’s quite different. It’s a progressive adding of units to the whole, then constantly checking the whole.
Of course this comes with an obvious downside: it seems to take a lot longer to complete the code. On the plus side, the finished product is free from at least obvious bugs. That’s because at each step of the way to completion, if there’s a problem, I sit down and tackle that problem and nip it in the bud. Knowing that the problem is probably in the recently-added code makes testing a lot more easier than looking at the complete product and slowly narrowing it down, and commenting out whole sections of code in the process.
Maybe this technique isn’t for everyone, but it’s seemed to work for me so far in producing quality code.
But on the other hand.. maybe everyone does this? I really don’t know! I just can’t imagine sitting down to write huge sections of code without ever testing it progressively along the way. Maybe this is some esoteric rule of programming. Or maybe it’s just too completely obvious for anyone to mention, so they don’t? ![]()
Leave a Reply
Categories
- accessibility (1)
- browser bugs (2)
- css (6)
- html (6)
- javascript (9)
- jquery (3)
- mobile (1)
- performance (2)
- php (1)
- regular expressions (1)
- rss (3)
- seo (1)
- Site News (1)
- table (1)
- Uncategorized (4)
- videos (2)
- wordpress (1)
- xml (2)
- yui (0)
I do that myself but always feel that it’s a very unprofessional style since professionals won’t spend tons of time on checking every 5-10 lines they write - their chance of error is very low.
I also feel ashamed if anyone would find me checking my code so often…