Yesterday, I was helping a coworker understand part of an application I had worked on previously. When we had finished going through his issue, he asked whether he needed to write unit test. Obviously, I recommended that he write new unit tests and ensure the old unit tests did not break. He then asked me how he should do that. This is where my assumptions caused a problem.
I tend to develop software using an IDE with various supporting tools and scripts. I assumed he also had a similarly working environment. However, he did not. Our company does not require the use of a specific IDE or toolset, which has its good side and bad side. The good side is that some people can use an IDE like Eclipse, IntelliJ or NetBeans. The bad side is that some people continue to use TextPad. For an application of significant size, a text editor is a painfully slow way to write code. So, I offered my coworker what I thought would be a good development environment based on what our company typically uses. Now, each person and company will need a different setup based on what you need to support, but some things are fairly standard. Following are some good tools that need to be part of your personal development environment, with a significant bias towards java development.
Integrated Development Environment (IDE) – An IDE is critical to your productivity regardless of your programming language of choice. If you say that you are fine with a text editor and a bunch of batch files or shell scripts, then I will argue that you have created your own IDE just in a minimalist sort of way. For java development, there are 3 major IDEs, Eclipse, IntelliJ and NetBeans. Sometimes I find it shocking that we need to talk about the benefits, but some people may need to be reminded. You get incremental compiling, search features, code completion, quick navigation and many refactoring options. With many of the tools in this list, there is likely some way to integrate it with your IDE as well.
Automated Builds – For the individual developer, you still need to have a simple way to generate a build. Ant and Maven are two of the popular choices. They both have plenty of community support and various plugins for other tools. Both allow you to create custom plugins as well, so that you are never really limited to what tools can be integrated. If you use Eclipse, you can also integrate your build scripts so that you never have to leave the IDE.
Automated Unit Testing – If you read this blog consistently, you have seen a few testing posts lately. Unit tests really are a fantastic security blanket. If someone new modifies code, you can quickly tell if something is broken or whether the tests need to be changed to reflect the new requirements. JUnit and TestNG are popular frameworks in the Java space, and there are frameworks for almost any language. I use JUnit because that is what I started with ages ago, and it has a good Eclipse plugin. I can quickly write a test in Eclipse, and click “Run As -> JUnit Test”. If I see a green bar, I am a happy man You can include all of your tests in your automated build to ensure that everything works well together. JUnit provides a way to generate HTML reports which display a summary of the entire project, each package and each class.
Test Coverage – You could have a ton of unit tests, but how do you know if you really are testing your code well enough? Test Coverage tools like Clover and Coberatura help you understand what lines of code are left untested. Sometimes the percentage numbers may seem a little off, but the idea is that you need to know if you have left something untested. My understanding is that you want to achieve over 90% test coverage, and hopefully about 95%. That last 5% is typically going to be exception cases that you hope never happen anyway. There are some Eclipse plugins for test coverage tools, but I am not a big fan as they feel like they get in the way. Cobertura does output some nice html reports, in the same style as the JUnit html reports.
Shell Scripts – I know I said earlier that you should use an IDE instead of a text editor and shell scripts, but sometimes there is just some minor task that needs to be done. The shell can also be used to automate things that do not have a plugin in your IDE. For Windows users, there are normal batch files, or you go for more unix flavor with Cygwin. For Linux and Mac users, you have the pleasure of a real unix shell at your disposal.
Deployment Server – If you are doing some sort of web development or server development, you need to be able to deploy your code quickly and easily. For web development, this typically means that you have installed your application server, e.g. Tomcat. More importantly, you want to make sure that you do not have to click 18 different links on some administrative console in order to deploy a new build. You could automate this using a shell script or your application server could have a plugin for your IDE. Whatever helps you deploy faster is a good thing.
There are likely a bunch of other tools that you could add to boost your producitivty, but this is the short list. One item that I would love to add, but is not always possible is your database server. In corporate environments, this is typically very difficult to get approved, but there is no harm in asking.
Are there tools that are indispensible to you that are not on this list?