Posts Tagged ‘maintainability’

Five Ways to Keep Your Code Clean

Tuesday, February 23rd, 2010

Because we have a team of developers here at eROI and a plethora of projects to build and maintain, it is more than likely that the code written by one individual will need to be edited by another developer at some point in time.  When an edit to a site comes in, the original author of the code will inevitably, at one point or another, be on vacation, be sick, or no longer work here (yes, it happens, sadly).  This is why it is so imperative for our team (and any development team) to follow certain guidelines to keep our code clean and legible, so that anyone can jump onto a project, easily see what the code is doing, and start making edits quickly.  Here are five ways to keep your code readable and maintainable:

  1. Indent Your Code
    This is number one on the list for a reason.  No other thing you can do can help or hinder the readability of your code than the indentation style (or lack thereof).  Nested child elements should be indented one level more than parent elements in order to show a visual hierarchy.  Opening and closing tags in HTML should be on the same indentation level in most cases; items inside the opening/closing tags need to be indented one additional level.

    (more…)