Improve Your Code Now! SIMPLE and Exciting Techniques to Improve System Quality

Yeah, I know the title sounds very corny - just like those howtos books.

Anyway - that is actually the title of the presentation that I gave at a place that I used to work. At that place, the developer team had to deal with .. to call it a spaghetti code would be a compliment, a big ball of mud would be more appropriate.

Without further a due, this is the presentation.

Improve the code – one line at a time. Refactoring / code improvement begins by small steps but if done by everyone over the period of time, it will evolve to a great system – a system that everyone will be happy to work with.
It will take commitment and perhaps some learning/training is needed if you are less experienced / knowledgeable in one area/several areas.

Why do we need to improve the code? Simple, the code is tangled, difficult to maintain and brittle. We all experience daily frustrations dealing with such codebase.

I will look at some examples from the codebase and suggest some simple improvements:

  1. Indent the code
  2. Fix spelling mistakes
  3. Fix HTML codes - unclosed tags, deprecated tags, mixed casings
  4. Move styles from HTML to CSS files
  5. Put comment to the code (especially the ones that are hard to understand). This also applies if you just figured out what a piece of code does, if it wasn’t obvious to you in the first place - chances are it won’t be obvious to other people in the team
  6. Remove codes that are not used (client left us), remove commented codes, remove codes by developers who have left the company and the codes are not in production. Dead codes make our application FAT
  7. Re-structure codes into different sections / includes – group them logically – learning from MVC concepts we can do similarly now!
  8. Avoid code repetition (DRY – Do not Repeat Yourselves) – do not cut and paste without thinking – use CFCs, Custom Tags, CFinclude, JS files, CSS etc2. Again do not make the application fatter than it is now.
  9. ?? – share your own ideas on what you can do TODAY that brings the quality of the code.
  10. Whenever you touch the code - make sure you make it better than before.