Saturday, July 12, 2008

//You do not need to understand this

Maintenance programming... hated by most, yet essential.

Good things to do for the poor sod who has to maintain your code after you left:
  • Comment clearly and not too much
  • Put in a clear roundup what the function is supposed to do
  • ... add some explanation for your parameters
  • Keep speaking variablenames, but go easy on the length :)
  • Be consistent in these names.. p preceeds a pointer, s a string, i an integer and so on
  • Avoid pressing complicated statements into one line
Bad things to do:
  • Ignore all of the above
  • i is good, use often like nested for{} statements with i for the outer loop and ii for the next :)
  • Take extremely good care of your pointers and never set them to NULL when you free()
  • Place comments like //Taking care of X... when you do nothing the like

heheeh.... maintenance programming has its ups and downs. But you can make it hell if you like. If you happen to hop into a job where you get thrown at code that looks like the latter... I do not envy you :)

No comments: