Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!ix.netcom.com!netcomsv!uu3news.netcom.com!netcomsv!uu4news.netcom.com!slc.com!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: isKindOf: discussion
Message-ID: <1995Dec12.193141.16246@slc.com>
Sender: news@slc.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <4aclhh$k5m@kirin.wwa.com> <4act2l$spj@newsbf02.news.aol.com>
Date: Tue, 12 Dec 1995 19:31:41 GMT
Lines: 31

bytesmiths@aol.com (Jan Steinman) writes:
<snip>
> However, the best suggestion was to simply send the message you want to
> send, and have the answer you require of all your objects. For example,
> you could define #currentFixedInterest to answer 0 for stocks, and the
> actual interest for bonds; then summing the fixed interest for an
> arbitrary collection of financial instruments works fine.
<snip>
> Jan Steinman <jan.bytesmiths@acm.org>

In a Smalltalk portfolio management application at a former employer
of both of us, Ward Cunningham wrote a report writer whose rows were
object of a type required for a particular report (i.e. transactions
or security positions as of a certain date).  We had the same kind of
mixed object problem, as a given report might have to show a mixture
of cash, short term, and long term securities.  We had many hundreds
of possible report columns (for each kind of report!), each with its
own query selector.  Some of these rows were meaningful only to a
single kind of security.

Rather than add "dummy" methods to all security types, Ward's solution
was to send the query selector to the row object inside an error
protection block.  When the report found a row which "did not care"
about selector for a particular column, it left that column blank.
He also took this into account when getting totals for a column.

All in all, a pretty slick system...

  Cheers,
  Alan
    (standard disclaimer)
