From: Brett <wak...@ea...> - 2005-04-03 00:44:18
|
On Sat, 2005-04-02 at 17:33 +0200, Erik Vos wrote: > 1. The basic unit of property would be Certificate (rather than Share). > Attributes would include Owner (see below), share (percentage), > certificateCount (against the limit - can be 0, 0.5 or 1). Looks ok. > 2. Each tradeable object would implement an interface Tradeable. > This would apply to Certificates and PrivateCompanies. > PublicCompanies are not themselves Tradeable, but hold an array > of Tradeable Certificates. > Minor companies like those in 1835 will have one 100% Certificate > (to avoid the need for a subclass MinorCompany extends PublicCompany > implements Tradeable). > Hmmm... I see the distinction you're trying to make, but I'm not completely certain this is necessary to do it. There doesn't seem to be any attributes specific to a Tradable that require an interface. I think this may just need to be a logical distinction and not necessarily something defined in code except as a coding practice. > 3. Each entity that can hold Tradeables (certificates and private companies) > > has a Portfolio containing some collection of Tradeables. > This applies to Player, PublicCompany and the Bank > (the Bank would have two Portfolios: IPO and Pool). > Portfolio could be a separate class, perhaps a subclass of some > Collection type (ArrayList or HashMap). > Or it would contain such a Collection type. Not sure what's better. > I don't think it's a good idea to have one repository for both private companies and stock certificates. There is significantly more operations performed on stock certificates than there is on private companies. I think these should remain separate. > 4. Each entity that has a Portfolio implements an interface Owner, > so that each Tradeable can have an attribute defining its Owner. > I think this is confusing the relationship between the objects. Owners should have a collection that stores their Tradables. We don't need to duplicate that specification by assigning an owner attribute to the tradable as well. Is there any use case where this would not be true? > 5. Maybe we will also need a separate interface Trader, > to define methods that an actively trading Owner must have > (sell, buy). This assumes that the Bank does not need such > methods (it does not initiate sell/buy actions). > If it does, Owner and Trader will converge into one interface. The only thing that can be sold is stock certificates, and it's only to the bank. Everything else must be bought. It may be pedantic, but I think it's important to make the distinction because buying is a generic action, and selling is a singular special case. I think this helps guide us to where we need to implement the logic and how. I'm not certain another interface is the right answer. ---Brett. After twelve years of therapy my psychiatrist said something that brought tears to my eyes. He said, "No hablo ingles." -- Ronnie Shakes |