Friday, December 09, 2005

Less vs Simple

We had a discussion the other day about whether simple is better than less. I always believe that the simpler the code, the better. To write simple code is a glorious thing. You will be praised by your successors and revered for understanding the tenets of good coding. Your peers will respect you and girls will find you attractive. Well, maybe not the girl bit, but the others will follow.

What are the tenets of good coding? (I reserve the right to change and reprioritise, based upon my current beliefs) :
1. Avoid duplication
2. Write testable functions
3. Aim for Simplicity
4. Reduce the cost of change

Now each one of these is a complete post in itself. And they require quite a bit of discussion for the intent of the statement is understood. I believe that to truly understand these guidelines you mush be switched on. The catch is that the switch is different for everyone.

A while ago I posted about an epiphany that I had. That was referring to the understanding just how important unit tests really are. It was one simple statement that a peer had said that stopped me in my tracks. I just got it. There were even more benefits than I realised at the time and further research and experience has taught me those.

From then on I always feel exposed when I'm writing functions that are not the subject of unit tests. Actually, the discussion of unit test is worthy of a complete other post as well. And covered under tenet #2.

Now you're looking for the meaty bit - the examples. Well, I'll get to those, but for now this is just something that I had to say to start the process. Soon, I'll post more on each of these topics and more.

Believe me when I say that I'm opinionated...

Oh, and if you're wondering if we won the Grand Final, mentioned in the last post, then yes we did.

1 comment:

sarahfisher8261 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog