I hope, you have already read "Preface" of my java power tools series.
Well, first of all let me clarify that I am not going to discuss metaphysical tips here like,
- Do caffeinated drinks improve programming productivity, or cause more problems?
- What are general programmer productivity tips at work?
- 20 ways to boost your energy (without relying on caffeine)
This post is aimed to encourage java developers for adopting some of productivity booster tools (primarily related to hot swapping and code generation) while coding. When I say java developer, I mean to say software programmer working on Java, J2EE and also related frameworks such as Spring, Hibernate...
Someone may say promptly that there are already many IDEs (e.g. Eclipse, NetBeans...) available to increase developer productivity. Although developers are using IDEs for java web or enterprise applications development, they may be getting frustrated because of known issues like,
Problem: Developer productivity loss due to java app compile, build and redeploy process
The considerable amount of time wasted in traditional build and redeploy process to see/test the changes against any code modifications. Even if you fix just typo in java or properties files, it demands redeployment and keeps you waiting for few seconds/minutes to test changes. TheJava EE Container Redeploy and Restart Report – measuring Turnaround Time survey found that java developers spend an average of 10.5 minutes per hour of coding on redeploying their app to see changes. And, the time wasted doesn’t include build time or the time taken for developers to focus into the flow again after waiting X minutes for the redeploy to finish. Well, below tips can help you to mitigate this.
Recommendation: Enjoy java coding by using JVM HotSwap / class reloading tools such as JRebel, Hotswap Agent, DCE VM, Spring-loaded, Fakereplace…
Click here to watch oneminute JRebel video to see how enjoyable coding becomes when you don’t have to restart while making changes to class structures, resource files and framework configuration files. Do further googling to get setup instructions for each of these tools.
The main purpose of such tools is to avoid traditional java development methodology --- change -> restart and wait -> check. So developers can do java code changes and check those immediately without the need of app redeploy or JVM bouncing process. That means, developers can focus more on writing code.
At this stage JRebel is the most mature and supports broad ecosystem (most of known containers, IDEs and java frameworks ) among aforementioned tools. But it is commercial and bit expensive. You are lucky, if your company can purchase it to increase your productivity. Below screenshot depicts that how it works in Eclipse IDE!
If your company cannot buy JRebel for you, then don't be sad. You can try open source and free Hotswap Agent project which is similar to JRebel, but main differences are:
- JRebel is currently more mature and contains more plugins.
- JRebel offers good reporting like time saved using it.
- JRebel is neither open source nor free.
- JRebel modifies bytecode of all classes on reload.
Other freely available hotswap projects are DCE VM, Spring-loaded and Fakereplace; which can also help you to test your code changes instantly whilst a JVM is running.
If you never experienced one of the above mentioned tools, then I would strongly recommend you to evaluate for your project environment. You should aim to adopt at least one of these to increase development efficiency.
Problem: Getting tired of writing the same java code or xml configuration, over and over again
Repeatedly writing same java code or xml configuration is tedious, but it is inevitable sometimes because the technology demands. For example - hibernate mapping xml files, web services code for given WSDL... Do you know that there are many tools available to take the burden of repetitive development tasks off your shoulders by automating them?
Recommendation: Use code generation tools as applicable to your project architecture. Some of those are,
- XDoclet - is a metadata-driven, code generation engine for Java, Hibernate, EJB, Struts, etc. Starting from simple JavaDoc-style comments, it generates deployment descriptors, interfaces, framework classes and other utility classes your project requires. For more detail, you may refer XDoclet in Action.
- Modelio - is a open source modeling environment. It offers various modules/plugins for code generation such as Java designer, Hibernate designer, WSDL designer, etc. See this quick video about how Modelio works for Java roundtrip engineering.
- JBoss Tools - a set of Eclipse plugins that supports JBoss Technology such as BPEL designer, ModeShape tools, Web Service from WSDL, Hibernate tools and many more.
Sometimes you may not leverage code generation tools fully, but certainly those can save you from writing some amount of manual code or configuration. Sometimes you may need to do some manual changes, once you get automatically generated code from tools. Still the code generation tools are helpful to developers for reducing some amount of drudgery.
- We should not constantly spend our time complaining about problem we may having; instead focus our time toward correcting the problem. Always remember time is value.
- I am not saying that, we should use all of the mentioned tools such as JRebel, Hotswap Agent, DCE VM, Spring-loaded and various Code Generation Tools. But we should certainly invest some time to evaluate such productivity booster tools, which are most suitable to our project environment setup.
- If selected tools are used wisely during the development, those can improve developers productivity tremendously.
- If you use Eclipse IDE, you can consider installing additional plugins to boost your productivity.
If you know or have experienced any other productivity booster tool which can assist java developers in their chores to increase coding efficiency, please add the name of such tool along with your experience of it in the comment.
- 14/Feb/2014 - Added my another blog post url reference in "Final Thoughts" section, which refers to few productivity related plugins for Eclipse IDE
I am not biased to particular free or commercial tools, rather my objective is about sharing my own experience on set of tools.