Over-indenting is the enemy number one

Share this topic:



Link to this posting

Postby Ursego » 21 Feb 2013, 10:42

Indent code fragments with as few tabs as possible.

That will keep your scripts simple and easy to work with.

Usually, an indentation of 3 tabs says that the code could be written in a more elegant way, and an indentation of more than 3 tabs is a "red light" and signals about incorrect organization of code structure. Tab is like salt in a soup: it's a must, but over-use will make the product worthless. If your code has long "staircases" of closing braces (}) or END IFs (and other code-branching keywords) then it's a good idea to take your habits critically!

Try not to exceed 2 tabs. If you find yourself over-indenting your code, consider extracting the whole fragment into a new function (see Code after validations).

I remember the words of one of my first project managers: "If I see more than 3 tabs in your code, you are no more in the project!" :evil: ...
User avatar
Ursego
Site Admin
 
Posts: 111
Joined: 19 Feb 2013, 20:33

Return to Coding Style

Who is online

Users browsing this forum: No registered users and 1 guest


Over-indenting is the enemy number one

Share this topic:


If you think that this site is not too bad, please LIKE it in Facebook. Thanks!





free counters

eXTReMe Tracker