Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Question on inheritance & association, pls help..

Thread view: 
krislioe@gmail.com - 04 Oct 2006 09:35 GMT
Hi all,

I have two classes SalesOrder dan Invoice. The business rule is :
SalesOrder is processed/approved to produced an invoice.

So there is association between SalesOrder and Invoice.

On the other hand, Invoice has all the attributes that the SalesOrder
has EXCEPT for one attribute. (on example below : priority)

SalesOrder : docid, docno, docdate, customer, salesman,warehouse,
priority
Invoice :       docid, docno, docdate, customer, salesman,warehouse,
                  DeliveryDate, LoadingDate, ReceiveDate, Amount

1) Should I create Invoice as subclass of SalesOrder ?

2) If the answer is yes, can we have both Extend and Association on the
relation of two entities like SalesOrder and Invoice ?

Thank you for your help,
xtanto
Chris Brat - 04 Oct 2006 12:10 GMT
Sounds like homework but anyway...

I'd rather have an abstract SalesDocument class that is extended by the
other two.

Have all the common fields and business logic in the SalesDocument
class and then have the Invoice and SalesOrder specific stuff in its
appropriate class.

You might only have one field that currently differs between SalesOrder
and Invoice but that can easily change - and you can add 'document'
specific methods where needed.

Chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.