Sunday, March 29, 2009

Gold Code

I'd previously written that working code is worth it's weight it gold. That is true, but it's only partially true.

Excellent code doesn't just work - proven through unit tests and structured manual testing - it is also written in an obvious way. Any old code monkey can take ownership of the code and quickly understand what it's meant to do and how it's meant to do it.

If they can't just pick it up and run with it then it's not gold standard software, It's probably tin, maybe bronze. Silver at a push. But certainly not gold.

Gold standard code uses no magic numbers, instead named constants are used. If magic number just have to be used, comments are mandatory.

Gold code is consistantly formatted throughout, commented where appropriate and has variable names that follow the 5 golden rules.

Golden code works and can easily be changed by anyone.

3 comments:

Anonymous said...

just curious: which 5 golden rules you're referring to? :)

Anonymous said...

apparently your link to the 5 golden rules has a typo: hreg instead of href.

thanks for the post!

Ian Hickman said...

Thanks for pointing that out, it's fixed now.