sale.submit() or submitter.submit(sale)
- From: greatlord_5@xxxxxxxxxxx
- Date: Sun, 27 Jan 2008 08:24:47 -0800 (PST)
Hi,
I am a newbie to OOD.
The application that I am currently designing and developing has a
situation similar to the following.
There is a sale that has to be posted to a ledger. The ledger is on a
mainframe and the sale comes from the web. The operation of submitting
the sale to the ledger is a big one and can be successful, failed or
undefined.
There are several different kinds of sales, such as OTCSale, WebSale,
PhoneSale and so on. They are different enough to merit different
classes. However, they are submitted to the mainframe in more or less
the same way.
My question is this:
Should the sale object have a submit operation in it? Or should there
be a separate Submitter class which accepts different kinds of sale
objects?
1. If the sale object has a submit operation, the hierarchy is this:
Sale class -----> base class
.... OTCSale
.... WebSale
.... PhoneSale ---------------> 3 sale classes that derive from base
Sale one.
The base Sale class will have a submit operation which is overriden in
each child sale class.
Thus, OTCSale.Submit(), WebSale.Submit(), etc.
2. If there is a separate Submitter class, then in addition to the
hierarchy in case 1(except submit operation), I need to have an
overloaded Submit operation in that class.
Thus, Submitter.Submit(OTCSale), Submitter.Submit(WebSale), etc.
Why should I choose one over the other? They both look reasonable to
me. In the future, if the submit operation changes a bit, one need
only change the Submitter class. But this operation has been pretty
stable so far. So is this a valid concern?
Thanks
.
- Follow-Ups:
- Re: sale.submit() or submitter.submit(sale)
- From: H. S. Lahman
- Re: sale.submit() or submitter.submit(sale)
- From: Daniel T.
- Re: sale.submit() or submitter.submit(sale)
- From: Nanne
- Re: sale.submit() or submitter.submit(sale)
- Prev by Date: Re: Business objects, subset of collection
- Next by Date: Re: sale.submit() or submitter.submit(sale)
- Previous by thread: Excellent Consultants Available for Different Position
- Next by thread: Re: sale.submit() or submitter.submit(sale)
- Index(es):