Clock Blog

Eclipse PDT Templates assisting CS

Posted on Wednesday, 14 July 2010 @ 16:48 GMT in tech-blogs by Robert Arnold

Coding Standards are important for a number of reasons:

  • Standards allow everyone to follow the same practices, which lowers the learning curve when moving between projects.
  • Coding standards make the reading of source code easier, thus lowering the time needed by a developer to understand it.
  • Standards make projects easier to maintain.
  • 80% of the software life-cycle is maintenance (Sun Microsystems).
  • Software is often not maintained by the original author.

For standards of any kind to work EVERYONE MUST do their best follow them.

With that in mind, Eclipse PDT has a very useful tool for setting the layout of classes, functions, logical statements and the like - it's called templates.

Fire up Eclipse and take a look at Preferences > PHP > Editor > Templates.

The name column indicates what you need to type to insert a template.

For instance, to insert the elseif statement, type the name "elif" followed by Control + Space bar  (select the template), and hit enter/return, and hey presto - a Clock coding standards else if statement pre-formatted for your usage.

These templates allow for import and export, so ensuring your developers have imported the templates, you can rid of statements like "oh I didn't know we structured function comments like that" et cetera.

blog comments powered by Disqus