Wednesday, May 03, 2006

EJB is not portable

Remember when Java bragged about being "write once, run anywhere"? Well in EJB land that does not seem to apply.

We did a port of a J2EE application to a new application server. We were able to finish it. I'd say that about 70% of the porting effort was spent on EJB. Around 15% was the GUI servlets. Around 15% was other stuff like documentation and the ant scripts and some J2SE clients.

The servlet stuff went well. There were just a few small things we were doing that were against the servlet spec that the first application server allowed, but the new one didn't. Easily identified and fixed.

EJB was a much different story. So much of it is vendor specific with designed lock in that porting is so much more effort and complicated. It just shows how painful everything is in EJB. It's painful just getting stuff to work on the original application server, let alone porting it to another one.

That's just not the Java way. Originally people liked it and used it because it was portable. When something is painful to port and requires code changes to port like EJB then that is not in the spirit of Java. It may be short term advantageous to application server vendors to discourage porting or make it expensive. But long term it's a bad thing. It undermines the cross platform spirit of Java and comes across as bait and switch.

I've grumbled about EJB before. I just don't get EJB or why people would choose it. It is painful to do anything in. It is so verbose with all the endless and non standard XML files. There are all these code restrictions that annoy and frustrate the programmers. Weird and tedious concepts and terminology in the EJB spec. Bewildering arrays of modes and options. Good luck connecting from an external J2SE program.

At every turn EJB comes across as developer hostile. Without developer support it will have a tough go of it long term. It's no surprise that new competing technologies have emerged and have gained support.

If I was the decision maker and was starting something brand new in Java with no legacy code base then I would not choose EJB. Just stay clear of it entirely and everyone will be happier and better off without it.

No comments: