Search and Re-Space

Back in the day, messy coding was a good form of job security for programmers, because the only person able to decipher your code was you. Not anymore. Messy code = inefficient = missed deadlines. Dot com’s and Web Development firms have to complete projects on time now, and that means problem resolution has to be faster than ever.

As a Web Developer, one of the most amiable things you can do for your fellow coders is to format your code in a presentable way, so finding errors, making additions, or basic editing is as easy as possible for them. Spacing is the single most important aspect of any kind of formatting. Done properly, it tends to lead the eye in some kind of predetermined sequence, like colors in a painting or an advertisement which draws your attention to key elements. Below is an example of how I like to format table tags, which can be extremely hard to correct if the formatting is not consistent:

<table width=”180″ border=”0″ cellspacing=”0″ cellpadding=”2″>

<tr>

<td>

<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”4″>

<tr>

<td>This is a nested table.</td>

</tr>

</table>

</td>

</tr>

</table>

Here is an example of the same code, but unformatted:

<table width=”180″ border=”0″ cellspacing=”0″ cellpadding=”2″><tr>

<td><table width=”100%” border=”0″ cellspacing=”0″

cellpadding=”4″><tr><td>This is a nested table.</td></tr></table></td>

</tr>

</table>

As you can see, it takes much longer to find where the nested table starts and where is ends.

But what is coding without a little personalization? Answer: boring. The long-term effects of sitting in front of a computer screen for hours on end can be enough to put most people into a permanent state of social hypnosis. The answer is to keep it clean, but be sure to “make it your own.” Sometimes adding space is the key, sometimes taking it away is better. It’s ultimately up to you.

So be sure to have a good look through your code and make certain it is consistent and easy to read, so others can share in the development of your ideas. In the end, it will decrease the time it takes to complete a project and increase the likelihood of you sticking around.