We had recently started going down the JSP/EJB route until a vendor reference through a curve ball at as. They stated that the overhead of EJB, the tight coupling (the number of classes to get to the EJB with interface ridgitity) and the cost (if you go with BEA or IBM) was prohibitive. I was wondering if anyone has had tried either pattern and decided to migrate to the other, i.e. JSP/EJB to JSP/java classes.
- Posted by: Chris Russo
- Posted on: November 14 2002 08:24 EST
- JSP/EJB vs JSP/Java classes and performance by Web Master on November 14 2002 10:31 EST
- JSP/EJB vs JSP/Java classes and performance by Rod Johnson on November 19 2002 06:08 EST
It really depends more on the system your builing and wether or not the pros of EJB outweigh the cons. Your "reference" listed some of the cons, but maybe you should look at the pros as well and then decide if its worth it. There are many threads on this site that dicuss the pros/cons and when EJB makes the most sense.
I think the mention of tight coupling doesnt make any sense at all. One of the benefits of using EJB is that you decouple your client logic from your business logic. I dont see how there is tight coupling there...and having to abide to an interface's contract will only make your system more flexible. You can change the implementation of your EJB's and your client code doesnt mind.
As far as the cost issue goes, you may want to start with a free container like JBoss and then upgrade (downgrade maybe a better word :)) to IBM or BEA when you can justify spending the dough.
It's true ejb is often overkill.
Use the best tool for the job.
Tight coupling and number of classes problem can be used by using good tools (eg xdoclet) so not really an issue IMO.
I don't agree with the cost factor - we've used JBoss 2.4.x and 3.0.x for over a year or so on our product system that runs our whole company and this is not a small system, and it runs like a dream - no real problems to speak of. So don't believe the salesmen who will tell you only weblogic or websphere will do!
But salesman don't lie. Do they?
EJB is overkill for many projects. Many web applications do not require EJB. EJB, used incorrectly, can lead to poor performance.
You should consider the following decisions:
- Does your application need to be distributed (using remote invocation)?
- Do you need to use EJB
I recommend you look at my new book, Expert One-on-One J2EE, which discusses these decisions in detail. (Many books don't, just pushing you to use EJB.) There's a sample chapter on the Wrox site which may be helpful.
- Rod Johnson