Friday, March 02, 2007

Write Dumb Code

I really enjoyed this article by Brian Goetz of Sun Microsystems, in which amongst other things he exhorts developers to "write dumb code" - in the sense of code which is straightforward, clean and follows obvious principles. I wholeheartedly agree with this.
There are two main reasons why code gets overcomplicated. The first is that in a way it's "easier" to code up a solution for a specific case, and then try to widen the solution to fit other conditions. What tends to happen here is that you end up building in lots of options and special code to cater for different things, which complicates and clouds the original aim. This is where refactoring is important. Refactoring is not a luxury - time needs to be allowed to do it properly.
The second reason is the programmer kudos that comes from complex solutions. I'm looking at a problem at the moment where there are layers of object caching and refreshing options in a situation where it's probably not even needed: the database does its own caching, so why reinvent the wheel?

1 Comments:

Betty C. said...

I just thought I'd leave a comment on this post even though I understand little or nothing of it!

How the heck are the move plans coming along?

When it gets difficult, listen to "I Believe" by R.E.M.! I see you're a fan too..

7:49 AM  

Post a Comment

Links to this post:

Create a Link

<< Home