Some differences between fine grained and coarse grained objects:
Note:
May be I am wrong but what I was thinking, coarse object means a big object, that has much responsibility. For example, suppose we are designing a system and we have identified logical entities (business domain objects) (I am not sure, it is right term or not) and now we want to come up with java classes corresponding to those. So should we try to map one entity to one java class (coarse object) or try that one entity should include many classes (each one will be fine object). However if we have really big object, facade pattern do help by bringing infront the small object with which we have to deal with.
- If object composition is based on Object references (not one for one attribute) , then its Coarse grained . If object composition is based on attributes, then its fine-grained.
- 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.
- If the object holds lot of information it is coarse grained. eg. Example: A single "Account" object holds the customer name, address, account balance, opening date, last change date, etc.
Fine-grained: More objects each holding less data. Example: An Account object holds balance, a Customer object holds name and address, a AccountOpenings object holds opening date, etc. There are relationships defined between these objects.
Note:
May be I am wrong but what I was thinking, coarse object means a big object, that has much responsibility. For example, suppose we are designing a system and we have identified logical entities (business domain objects) (I am not sure, it is right term or not) and now we want to come up with java classes corresponding to those. So should we try to map one entity to one java class (coarse object) or try that one entity should include many classes (each one will be fine object). However if we have really big object, facade pattern do help by bringing infront the small object with which we have to deal with.
No comments:
Post a Comment