Make Code Readability your Priority - Get Out of the Perl Mentality

One thing that has always been important to me, no matter what coding language I am using, is maintaining readability of my code.

We are always under pressure to get our developing done, although a bit of forsight can help with maintanability in the future.

The Perl mentality is the idea of solving a problem in a script of as few bytes possible. Back in the early days of coding, memory and processor cycles where precious. A saving of either of these helped your program run quicker and in some cases actually work.

This led to shortcuts, such as using 2 digits for the year (e.g. 89) instead of four (e.g. 1989) - and we all know what lead to.

Getting back on track, the perl mentality would give us something like this in a php for loop:

if ($condition == true) echo 'TRUE!';

By squeezing onto one line and skipping off the curly braces, we have saved a few lines and bytes in our scripts. But at what true cost? Shortcuts like this are harder to read and a page crammed with code doesn’t go easy on the eyes.

Another piece of advice I sometimes hear; “Use tabs instead of spaces, as a tab is 1 byte and a space is 1 byte each”. It is a fair point, but consider that editors will display tabs at different widths causing your script to look completeley misaligned on other editors.

Stop hording the bytes and processor cycles, and you will give yourself a greater asset; time.

Are you a Developer, Designer or Copy Writer? Or Looking For One?

Click here to see 100s of jobs updated every day that you can complete to earn good money. Also find that programmer, designer or copy writer you have been looking for - advertise and get the best guy for your job - click here to find out more

1 Comment so far

  1. Konservir on February 7th, 2007

    Nu zdarova !

    I just wanted to pass on a note to let you know what a great job you have done with this site. Thanks!

Leave a Reply

Make $100,000/Month - Every Month!

It Works! We Make Our Customers Millionaires! Act now and get $600 bonus and a Free Money Making Website! - click to get started