Saturday, July 26, 2008

Write Easy to Read For Loop

When it comes to for loops, first thing a programmer thinks is what to name the counter variable. I am talking about old styled for as shown below :

for (int i=0; i <>
// really long body.

What to name the counter variable? If you name just i or j as shown above, it is not readable, but it easy to program. If you name something meaningful e.g. someItemOccurenceCount, it is painful to copy and paste when you need it e.g: someArray[someItemOccurenceCount]. IDE's auto-completion feature is useful, but to invoke every time is a pain.
Well with any IDE, you are in luck. You just write the loop with i, j, or k, or any of your favorite alphabet. Once you have finished writing the whole loop, just use refactoring. And look, IDE will change the one letter counter with any meaningful word you might choose.

Friday, July 4, 2008

Fast Code Eclipse Plugin

Fast Code Eclipse Plugin has been released in beta mode. It can downloaded from

It's capabilities are many e.g
  • Automatically create DAO to Service and Service to Action, e.g. FooDAO to FooService and FooService to FooAction.
  • Automatically create one DAO to another with different name, e.g. FooDAO (with methods getFoo, saveFoo, etc) to BarDAO (with methods getBar, saveBar, etc).
  • Also create spring based configurations.
  • etc.
Details documentation can be found at the project homepage above. Questions, comments, suggestions etc can be sent to fastcodejava (a t) g m a i l.

New bugs or issues can also be posted in the bugs database :

The plugin is not quite complete, but I have released a preliminary version which can be used.