ranchers, i just joined a new project in my company and was looking at the architecture of the project where i noticed some thing and wanted to discuss with some questions at the end.
we have some staandard tables in data bases and corresponding java objects , for ex. policy table in database and policy object (java class named policy) and as most of the designs policy object is having gettter and setter method for all the fields we have in policy table. the database table and objects are standard and we can not modify them
we have created a database table called PolicyExtension where we can add fields as per our requirements, basically what i mean to say is , since we can not add in to policy table we are adding in to PolicyExtension similary we have a class PolicyExtension where we can add the getter setter method for PolicyExtension table.
NOW THE REAL QUESTION .... when i saw PolicyExtension class i was expecting it to be inheriting Policy class but it is not inherting
when i try to contact the Architect the answer that i got was .... "our pattern treats Java extension objects as a piece of a logical composite rather than as a specialization"
what i understood from this line is ....we are actually creating an object of Policy inside policyExtension class and using it but what i did not understand was why do we need to do this and what are the advantages of this kind of design and how it is better ?
i tried to describe my scenario as better as i can be please let me know if i can still improve it.