Welcome to X.U. Chronicle Journal Sign in | Join | Help

X.U Java Chronicle

About The Author - Liming Xu Creator of Jumptree Project Management Software
Java to .NET, Back To Java Again, My Little Impression of The Two.
After 8 month of dedicated time on my project management software using .NET 2.0, it's finally done and meanwhile, back to my Java day job agian.

Been at my new job for about a week and I have been trying to setup the project Skelton using JSF, Hibernate, Spring and deploy using Tomcat/Jboss/Websphere servers in Eclipse, my my, it is me or is that a *** load of stuffs? 

Honestly,  I personally don't have any strong preferences as Java is better or .NET is better, but the issue is in setting up the environment first before starting any real development. How many Java developers (and I don't care how senior you are) can honestly say you don't get a headache when you tries to setup your projects? Before we are done setting up Java environment, the .net developers are probably already done coding data access layer and sipping their hot coffee while watching TV.  So far, these are what I have downloaded in order for me to START the setup...
  1. JDK 1.5 (similar to .NET SDK)
  2. JRE 1.5 (similar to .NET runtime)
  3. Eclipse Core (similar to Visual Studio)
  4. Eclipse WTP project (similar to Visual Studios's build-in projects like class projects, web application project and etc)
  5. Hibernate IDE
  6. Spring IDE
  7. Ant  (NAnt)
  8. Maven 2
  9. Tomcat 5.5  (Tomcat/JBoss, Websphere is similar to IIS)
  10. JBoss 3.2
  11. Websphere Server
and I haven't even included the *** loads of open source projects like
 
  • Jakarta commons,
  • myfaces,
  • taglibs,
  • displaytag,
  • JSTL,
  • BSF,
  • AXIS,
  • Xceres
 
just  to name a few in addition to reading all of their documentations such as configurations, requirements, dependencies on other libraries and what not.

I addition we have to really pay attention to the versions of the jar files, some frameworks are compatible with a  v1.5x jar while some other frameworks simply do not work with it.  Can you say jar hells? (So you spoiled .NET brats, stop complaining about your stuff!)

While reading up the gazillions types of configuration files and gotchas, I realized that I had a problem in Eclipse. How do I setup multiple projects in a eclipse workspace (equivalent to the idea of a Visual Studio Solution) and each on their own needs to be compiled into jar files (dlls in .NET)  and yet, when I reference them in yet another web project  which will be deployed as .war file (similar to ASP.NET web deployment project, generate one dll for the whole website), so they do not produce duplicated libraries? 

For example, in my Data Access Project, say I reference log4j and in my BusinessLogic Project, I reference log4j again. When I generate the two jar files from the two respective projects, I certainly do not want log4j get to included twice and more importantly, don't include two different versions of the same log4j!  It just make sense to move a single log4j.jar onto the upper level. In addition, I have another web app project. I want Eclipse to build all three projects, generate the jar files for the Data Access Project, Business Logic Project and automatically drop them into my web app's WEB-INF/lib directory, and lastly build the war file. This way, I can focus on my web project as that's the only one i really "cares". Eclipse just doesn't seem to have it in it. Its java build path is only for compilation time, but it doesn't do anything in terms of deployment (Now I miss Visual Studio)

My first reaction was a customized Ant script is needed to build/deploy project, but then it's just so tedious, to write "mkdir", "delete", "targets", "dependency", "classpath", "includes" and etc etc. I'm just REALLY lazy.  So guess what? I tried to find an easy way out, google it first and to my surprise, I ran into the Apache "Maven" project which is so absolutely fantastic, it offered more than what I had in mind,  I was simply beyond joy.

Maven is somewhat similar to the "Guidance Package" in the .NET 2.0 world and you can build customized "software factories" using its framework. What's more interesting is that the libraries you need such as log4j and Junit, it's downloaded during compilation from a gigantic online repository sorted like C-Span for perl and stored in a local "repository" for caching, no longer do you need to manually download the prerequisite libraries before-hand.

This lead me to test out Maven 2, it included quite a collections of "software factories" such as plain java projects, web projects and etc. After a few simply commands, Maven automatically created the structure for me and then by simply typing "mvn eclipese:eclipse", it generated the whole Eclipse project files for me!! Import them back into Eclipse, and viola, a best practice project structures is ready for me to code and I can be on my happy way to Spring/Hibernate. Though I have a feeling, integration of spring/hibernate will not be an easy task either.

I do wish though, Maven 2 could have a software factory  that mirrors what we get in our .NET's Web services factory which automatically sets up several different projects (Business Entities, Data Access, Business Logic, Services Data Types, Services Contracts, Services Implementation and Web) and then probably references them with each other. It'd greatly simplifies the time any Java developers have to spend before starting up a project. This in my opinion, the biggest hurdle I have in Jav. , .NET/Visual Studio simply have an upper hand to get anybody start developing application faster.

Maven2 does have an Eclipse IDE plug-in which helps you build dependencies and deployment (with a little bit manual intervention required, such as setting a parent pom.xml above all projects) and what not, but in my opinion, these features should be by default, included in Eclipse, similar to how Visual Studio auto compile projects into dlls and then properly drop the dlls into the "/bin" directory of the projects that references them, no duplication.

Of course, again Maven2 offers more than simply setting up project structures, additional features include the build-in support for unit testing and etc. This is actually something the .NET Guidance Package could improve to make it easier. (btw, is it me or is it just hard to write custom guidance package/software factories in .NET?)

Having said all these, integration of various java projects together really do take a lot of Java people's time, it's no joke, but it's not desperate. For example, the open source project "AppFuse" does a fantastic job integrating various frameworks for us, I strongly encourage everyone to give it a shot and see how much time it saves you.

So which platform do I like? My impression is Java offers a lot flexibility and choices, but at the same time introduced the "Paradox of Choices", having so many things and integrate them together is no easy task, it simply overwhelm the human brains. .NET on the other hand is in a controlled environment, less choices, but easy to develop.

You can just feel the culture differences between the two camps. Java pps typically seems to like developing very good "high-level" programming frameworks like Eclipese (awesome features in areas such as its plug-in), ant, maven, struts, hibernate and spring(which has been ported to .NET as well) while lacking in areas of better end-user experiences.

.NET pps focus more on helping developers to do less thinking, happier end user experience while lacking in  originality and innovations (I simply don't see the amount of brilliant open source projects in .NET) 

To make an analogy, Java ppl are Americans who invented car, brilliant minds who think outside of the box, but American cars simply is not as enjoyable :)  .NET ppl are Germans, make absolutely BEAUTIFUL/enjoyable cars, but did not invented anything particularly stunning and the car breaks all the time!  

This ends my little speech of the day
Posted: Tuesday, February 20, 2007 5:17 AM by Liming

Comments

Anonymous comments are disabled