Xtremax - Web Design

22 Feb, 2010

Neat and Tidy Web Development

Posted by: Mr Otter In: eclipse| technology

I am not the tidy soft of person.  In fact, I hate doing housework.  But something about untidy codes really irks me.  Recently, we adopted the use of crucible as a code review tool.  It revealed a whole lot of badly formatted codes in our projects.

The codes look innocently neat and tidy in the Eclipse IDE, i.e.

image

However, the minute they are committed to the server, the formatting runs in fisheye.

image

So what’s the reason?  The main culprit is the use of tabs.  Tabs render inconsistently between the IDE and the web interface.  As a matter of fact, this is a common problem, and most open source projects have a rule to forbid the use of tabs in their source codes.

However, such stringent coding policy will require a powerful code formatting tool which will ensure that our developers can easily adhere to the standards.

Ah.. that is solved by our PHPEclipse, with its nice tab to space conversion tool…

image

All we need to do is to go to Preferences >> PHP >> Code Style >> Formatter and set the tab policy to convert all tabs to a 4 space indent.  Once that is done, all we need to do is to do a

Ctrl + Shift + F

To perform source code formating in eclipse… and hey presto!  Nicely formatted codes in both Eclipse and Fisheye.

image

image

Bookmark and Share

No Responses to "Neat and Tidy Web Development"

Comment Form

Xtremax Web Design Portfolio

    Opera Estate Primary SchoolNational Association of Travel Agents SingaporeFUMIYAMA CORPORATIONEngineering Education PortalBOON HI-TECH SUPERSTORESingapore Tourism Board

About Xtremax

This is all about a group of hard-core web developers who go about rambling about their daily efforts to make the internet world a better and more accessible place.