EJB design: Difference between Fine grained and Coarse Grained objects
Can anybody help me in konwing the EXACT difference between the Finegrained and Coarsegrained Object?
- Posted by: Udaya Bhaskar
- Posted on: July 28 2004 11:16 EDT
Some differences I came accross are
a. If object composition is based on Object references, then its Coarse grained. If object composition is based on attributes, then its fine-grained.
b. If there are very less business validations/logic, then its fine grained and converse is coarse grained.
c. if there is one table to one object mapping, then its fine grained. If there is one object to more than one table, then its coarse grained.
Pls clarify me. Is all these differences are correct ?
- Difference between Fine grained and Coarse Grained objects by Jeff Genender on July 31 2004 17:11 EDT
A. I would agree...but only if object reference is not mapped one for one with the attribute. The object should encompass multiple attributes for this to be true.
B. Not necessarily. You could have a value object passed in with little-to-no validation. I don't think you presented an accurate correlation here. Validation has nothing to do with its "corseness".
C. I disagree here. Mapping of the table 1-for-1 with the object has nothing to do with fine vs corse grained. You could easily map tables one-for-one (which is common practice in EJB CMP 2.0). Effective use of value objects could provide single round trip adds/updates with validations, and thus would be corse grained.