• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

coarse grained & fine grained

 
LAXMI VEMARAJU
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could some one explain me what is coarse grained and what is fine grained?
Thanks,
Laxmi
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Coarse Grained -
Address myAdress = bean.getAdress();
Fine Grained
myAddress.street = bean.getStreet();
myAddress.city = bean.getCity();
myAddress.state = bean.getState();
...

Note difference in the number of remote invocations to a remote object
 
Sanjay Raghavan
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Coarse grained and fine grained is important in the understanding of value objects with Entity beans.
The Sun Blueprints suggests that the client not make many method invocations to the Entity bean because it causes higher n/w usage. Instead they recommend the use of value objects. All the bean data can be wrapped in a value object instance and that can be sent across the wire.
Hence you deal with fewer (coarse grained) method requests.
 
LAXMI VEMARAJU
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sanjay, rafus.....so you mean to say Session bean is Coarse , and Entity is fine grained ?
 
Sanjay Raghavan
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not necessarily.
With respect to Coarse grained objects SUN says -
1. Whenever possible reduce the number of calls to Enterprise beans.
2. This implies coarse grained EJBs
3. Use value objects to hold data.
Sometimes a session facade via a Stateful Session bean is used to provide a simple interface to a complex set of subsystems (assume you need to query Entity beans many times or query multiple beans.)
While this may not exactly constitute a value object (SFSB can hold conversational state by itself), it does rreduce the number of calls the client has to make over the n/w.
HTH.
 
LAXMI VEMARAJU
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sanjay.
 
Chana Campos
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
Just a note from the performance and remote invocation side - how you package your EJBs, jars, wars and ears can make a huge impact on your J2EE performance. For example, two EJBs that are linked together in the same jar file by using the <ejb-link> tag can avoid a remote call..this is also the case in an ear file where you may have several jar, wars and other components together...an ear file can potentially save you from making those network calls.
I was on a project recently where they hadn't put ANY of their components in archive files...every call they were making was essentially remote! And they couldn't figure out why their performance was so bad <g>...there's a lot of power behind these simple little archive files and XML files..<g>
Cheers,
Chana
 
Atif Shah
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What i presive with fine grain and cross grain is
the level of abstraction.
the more highr level you go you reaching towards cross grain more low level for fine grain.
well you already have some expamples such
as acessing Entity bean using session bean
or accessing set of session bean using session fecade.
so in simple i understand it by
"what level of accessibility" an object have..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic