permaculture playing cards
The moose likes Servlets and the fly likes FIne Grained and Coarse Grained Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "FIne Grained and Coarse Grained Objects" Watch "FIne Grained and Coarse Grained Objects" New topic

FIne Grained and Coarse Grained Objects

Dean Jones

Joined: Jun 18, 2002
Posts: 24
hey wat r fine grained & coarse grained objects.
which of them shud be used and in which condition
Dean Jones
Alex Belt
Ranch Hand

Joined: Jul 12, 2001
Posts: 57
A fine-grained object is an object that contains a 'small' amount of data, while a coarse-grained object contains a larger amount of data, typically containing several fine-grained objects.
To demonstrate, let's say that we've created a system for entering orders. Typical objects in this system would be Customers, Orders, and Order Items. An Order Item would be a fine-grained object, as it contains the details about a single-ordered item, such as description, qty, price, etc. An Order would be a coarse-grained object, as it contains many Order Items and a Customer object as well.
Which should be used where depends on the application. In the example above, if a customer service rep wants to retrieve data regarding a particular order from a network server, it makes more sense to retrieve the Order object and display that data on the screen rather than retrieve all the Order Item objects individually.
Hope that helps.
It is sorta covered in the JavaRanch Style Guide.
subject: FIne Grained and Coarse Grained Objects
It's not a secret anymore!