IntelliJ Live Templates

I am a huge fan of IDEs. I truly believe that a powerful IDE can boost a programmer’s productivity by orders of magnitude. Additionally, i also believe that each developer should treat his/her IDE as a tool in his/her toolbox and try to get the most out of it. Having said that, making ourselves familiar with the IDE’s features (i.e debugging, profiling, refactoring utilities) and shortcut keys is a must. Everybody should invest time in those things. In the beginning it may be tedious, but in the long run it really worths it.

My personal choice of IDE is IntelliJ IDEA from Jetbrains. The Jetbrains guys have done an amazing job in creating one of the best technological products out there, according to myself. Their offerings are not only Java related for those who are interested in checking their products.

IntelliJ IDEA is such a powerful IDE that a developer can do almost everything from the keyboard. When i started using IntelliJ i forced myself to learn every shortcut key that i was using and just use that. In some cases i disconnected my mouse so that i would be forced to just type my way in achieving things. And i found out that i could work on it as comfortably with or without a mouse. I also found out that just by using the keyboard i was more productive, as my ‘muscle memory’ was kicking in every time and i did not have to take my hand off the keyboard to reach the mouse and think of the action that i wanted to perform, being in danger of loosing my momentum.

One of the features that i love and i use is their “Live Templates“. The live templates is a mechanism where the developer can use already existing or create his/her own code snippets and add those to code by just typing an abbreviation followed by the ‘tab’ key. Someone can create a new live template or a new live template group by going to Preferences -> Editor -> Live Templates. It definitely makes sense to have the most common patters as live templates. Three of my favourite that i use almost always when i program are the following.

Unit test case:

Main method:

SLF4J Logger:

There are lots of others built into the IDE, like for-loops, System.out.println() statements etc, that are commonly used.  I believe that there is no limitation on any live template that someone want to create according to his/her needs.

But whatever tool you use in your everyday life, i would strongly recommend spending some time in learning that tool inside-out, as the benefits of that are tremendous.