can anybody explain the above conceptions. i am not quite clear about that. any resources on the Internet is also ok.
thanks.
-
fine grained vs. coarse grained EJBs (2 messages)
- Posted by: song xiaofei
- Posted on: March 06 2001 02:39 EST
Threaded Messages (2)
- fine grained vs. coarse grained EJBs by Niels Ull Harremoes on March 06 2001 06:47 EST
- fine grained vs. coarse grained EJBs by Michael Ondrejko on March 07 2001 16:54 EST
-
fine grained vs. coarse grained EJBs[ Go to top ]
- Posted by: Niels Ull Harremoes
- Posted on: March 06 2001 06:47 EST
- in response to song xiaofei
The simple explanation is that in fine grained EJB's,
every object will be made a separate EJB. With coarse grained EJB's, you wil have big "fat" EJB,s, containing a lot of application logic.
An example: You want to represent an order consting of a number of order lines.
You can make each order line its own EJB (fine grained), or
you can have one EJB encompassing the entire order (coarse grained). Of course, in the coarse grained case, the order EJB can still use other helper classes for the actual implementation, but they are not exposed to the client.
There are pro's and con's to each approach - in general, coarse grained EJB's seem to be preferred.
Coarse grained:
+ Fewer EJB calls - less network load, fewer transaction context,
+ Simpler deployment
+ Fewer objects for the application programmer to learn
- CMP harder to set up
- Potentially less reuse
- Less distribution
Regards
Niels Harremoës
-
fine grained vs. coarse grained EJBs[ Go to top ]
- Posted by: Michael Ondrejko
- Posted on: March 07 2001 16:54 EST
- in response to Niels Ull Harremoes
Also, keep in mind that EJBs should only be created for data that must be remotely accessed. If it is only used on the server-side, there are other mechanism available with much less overhead.
For more information and guidelines on this issue, see the J2EE Blueprints.