views:

202

answers:

5

I don't have any knowledge of Java platform and I wonder which tools (and methodologies) could be used to help developing maintainable code written in Java.

I know one can use:

  1. Agile methodology in any environment
  2. jUnit/jMock for unit testing code (similar to NUnit/Moq in .net world)
  3. Checkstyle for coding standards - is this similar to StyleCop or FxCop or both?
  4. I suppose you can also write layered applications in Java (like assemblies for different tiers in .net)
  5. Are there any automated testing OSS/Licensed tools that are worth mentioning
  6. Are there any code generators that are very popular in Java world

Are there also any other popular tools/methods that a Java developer/team can use that I don't have access to in .net world? Would you suggest other tools and approaches in Java world?

+1  A: 

Responding to #2: Code coverage tools like EMMA are often used to evaluate the extent of current tests. Responding to #5: Findbugs and PMD are extremely popular static analysis tools.

pianoman
+1  A: 

You can use Hudson together with ant or maven as an continuous integration server. Testing your code at specific times and after each checkin. You can combinte Hudson with JUnit, Emma, FindBugs, Pmd and checkstyle to measure the quality of the code in your repository. If you are doing this I recommend installing the continuous integration game giving your developer a high score for fixing tests and warnigns, and negative points for breaking them.

Janusz
+4  A: 

In java there are a lot of frameworks. For example, you don't have to use JUnit, you could use TestNG with basically just as much tool support. There are several mocking frameworks as well.

In terms of coding standards, IDEs come with that built in, as well as there being several others available (I'm most familiar with the IDE ones, so I don't know names off hand).

You have Eclipse as an IDE if you want free, as well as NetBeans and for money there is IntelliJ IDEA among others. Then there are some IDEs from big vendors intended to support their specific application servers.

In terms of building "assemblies" (jars, wars and ears in the java world), there are some built in tools in IDEs for one-man projects, and there is Ant or Maven for a full fledged build tool.

There are many options in automated testing tools. If you mean continuous integration, there is CruiseControl that is free, and TeamCity which has no cost for low usage.

In terms of code generators, in general the Java world is kind of trying to move away from them in favor of annotations, but the name that comes to mind is xdoclet. In GUI building there are a bunch of code generators strictly for building the GUI of course.

That really barely scratches the surface. For example, application servers (JBoss, Oracle (they now own two with the Sun purchase) and IBM among others) are a big decision point in many Java projects (it depends what kind of project).

None of the categories discussed are intended to be exhaustive, just enough to give you a jumping point of what to look into. There are many more in each category.

The great thing about Java is that there are so many choices. The bad thing about Java is that there are so many choices ...

Yishai
thansk for a really thorough answer with a nice hint of humor. :)
Robert Koritnik
A: 

I'm not convinced that any one set of tools/methodologies/processes will guarantee you get maintaniable code at the end of it. So much of this comes down to the programmers who develop the project. Are they craftsmen/women committed to producing excellent code or just code-cutters aiming to get the job done. Looking at it another way, it's possible to have great processes in place and still produce poor code. And great programmers can produce maintainable code despite poor processess/tools or the lack of them.

That said, I'd still insist on the basics: source code control, branching for each change with regular check-ins to the main branch, automated build and test, lots of test code, basic static analysis, bug tracking and so on. That's on the tool side. On the coding side, regular design and code reviews, n-tiered architecture, loose coupling, etc. Most of this is language independent. So what's been working for you in C# should translate to Java.

For Java, I've found JUnit very good for test code and Checkstyle pretty good for maintaining a coding style.

dave
What were the downsides of Checkstyle that you labeled it "pretty good"?
Robert Koritnik
It's been a while since I used it but I only had minor gripes. It did do a good job. Occasionally there were false positives that were hard to turn off. Sometimes this lead to code that did nothing with a comment next to it like // to shut Checkstyle up.If you're going to use a style checker, I would recommend using it from the very beginning. We added it half way through on a project and suddenly had literally thousands of warnings to clean up.
dave
+1  A: 

The best tool for Java development is great Java programmers.

If you manage to hire a few that are really good, the rest will take care of itself :)

Gregory Mostizky