File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes is EJB against OOAD? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "is EJB against OOAD?" Watch "is EJB against OOAD?" New topic

is EJB against OOAD?

Ernest Lee
Ranch Hand

Joined: Aug 20, 2001
Posts: 145
from my understanding, EJB have entity bean for data (persistance class), and session bean and message-driven bean for process........
isn't it against the rule of OOAD? please explain....
Ernest Lee
Ranch Hand

Joined: Aug 20, 2001
Posts: 145
too stupid to ask?
Greg Whelan
Ranch Hand

Joined: May 18, 2000
Posts: 52
Perhaps you should clarify what it is about EJB that you think violates OOAD?
Certainly the component model that EJB uses enforces some limits on the design choices that are typically available in writing a normal Java class, is this what you're referring to?
Ernest Lee
Ranch Hand

Joined: Aug 20, 2001
Posts: 145
Yes, for instance, in normal OOAD we would have a Order class and we will have Order.getPrice() to get the total price for the order.
But in EJB, we will have a Entity Bean Order to store all the order related data and then maybe a OrderHandler session bean to actually go and calculate the price for the order, am I right?
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
You are right in what you are saying, and there have been a fair few discussions on the subject in the past. One of the main arguments is that you are separating data from the functionality that operates on that data, hence breaking the rules of encapsulation.
It all depends on how you partition the functionality to be honest. From a reusability perspective though, splitting out the business process logic from the data representation does make sense from a component-based development perspective since you can reuse the data representation components throughout your enterprise. After all, you are more likely to be able to reuse this over the business logic.
I think that there are some threads on that discuss this at length.
Anybody have any other thoughts?
I agree. Here's the link:
subject: is EJB against OOAD?
It's not a secret anymore!