Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Coarse Grained v/s Fine Grained Objects

 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
can anyone tell me about Concepts behind Coarse Grained Objects and Fine Grained Objects.

Thanks and Regards,
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gowda,

Basically all questions I have seen regarding coarse and fine grained calls are related to the Transfer Object pattern along with Business Delegate in a distributed environment.

Let me describe a concrete example :

Supposing you have a remote object named as "Customer" which have many properties such as Name, Address, Phone Number and so on ...

You are required to show in a JSP page all customer data, so for every customer's property shown in your web page you would make a remote call to the remote object in order to get a single property value.

By far it's a very bad approach because of network traffic required and because of your code is not isolated from network exceptions.

Here comes the Business Delegate which makes a UNIQUE and SINGLE coarse grained call to the remote object and deals with any network exceptions in order to create a LOCAL bean (A.K.A Transfer Object) which contains all properties you need to show at your JSP Page.

After that, you have locally available a bean (Transfer Object) which you can make fine grained calls to every property locally.

Note that while this approach can reduce the network trafic and reduce coupling, it also can lead to out-of-dated data once the local bean may not reflect changes on its underlying object until a coarse grained call is performed again.

Did you get it ?

I hope you understand the whole point.
[ October 30, 2006: Message edited by: Edisandro Bessa ]
 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bessa.
Can you tell me how local object will be accessed?
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the JSP will access your local object
by using EL expressions

example - ${customer.name} FINE CALL
where "customer" is a bean obtained by a COARSE call
and "name" is its property
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic