Yesterday, I was doing some refactoring on some code in Rational Application Developer (a derivative of eclipse) and I ended up creating a couple of new projects to house some of it. When I told my colleague he’d need to synchronize with CVS and pull down the new projects he expressed some concern about why I had created the new projects. It made me revisit why I actually did it.
Basically we have a large project that consists of 2 JEE applications (an admin app and a ‘dashboard’ app), 5 offline Java ‘batch’ applications, and several other applications on other platforms (iSeries ERP, Mainframe, etc). I originally broke the Java projects (in the Eclipse sense) into the following projects:
I wrote the domain model in the ZZZDomainModel project as the first step in the development process. He joined after that and began work on the ZZZAdminApp. Since I hadn’t done any persistence in the domain model, that was something he took on. When I synced up with the repository a few days later, my ‘AllTests’ TestSuite immediately failed. The reason it failed was that he had added persistence to the ZZZDomainModel project. We’re using Hibernate, and he had created a Hibernate config file and mappings that I didn’t yet have. It hit me pretty quickly that the persistence stuff didnt ‘go’ with the domain model stuff. So I refactored it and made a new ZZZPersistence project. He argued that the persistence and domain objects might go together since the persistence was meaningless without the domain. We went round and round for a while and I still felt like persistence was separate. He argued pretty effectively that some of the arguments I was using for different projects were really arguments for a better package structure. Even though I felt strongly about it, I did see his point a bit. Was I overcomplicating the structure with projects? Should I have worked harder on the package structure rather than just making separate projects? Tough call.
Ultimately his arguments dealt with the complications of making and packaging jars, wars, and ears with the additional project structures. We discussed how these additional projects would add complexity to the deployment of all of the ‘runnable’ applications that used them. In the end we left them the way I had refactored them, but I felt a little uneasy about his opinion of leaving them that way.
This evening I was reading some blogs and a few Maven references jarred my mind to realize that the complexities that we were discussing were easily handled by project/build tools like Maven and ANT. I’ve always known how they helped, but this was a great example of why these tools even exist.
I’ll definitely be considering this issue more over the next few days. Any opinions welcomed