Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!europa.chnt.gtegsc.com!news.sprintlink.net!noc.netcom.net!netcomsv!uu3news.netcom.com!netcomsv!uucp3.netcom.com!slcgate!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: is Smalltalk a safe language ?
Message-ID: <1995Jul3.213821.27506@slc.com>
Sender: news@slc.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <3rmc29$jce@rc1.vub.ac.be> <Jan.Bytesmiths-2306951413340001@138.120.62.112> <69355120@to.mobil.com>
Date: Mon, 3 Jul 1995 21:38:21 GMT
Lines: 45


curt@to.mobil.com (Curt Welch - RDR) write:
<snip>
>  Can you give me examples of what type of proxy objects you have created
>  in the past so I can understand what type of problems my language would
>  cause you if it didn't have the necessary features (like perform:,
>  become:, or the ability to override/catch the does-not-understand
>  signal.)
<snip>

At a former employer, I worked on a financial application product
written in Smalltalk.  We often used wrappers to slightly modify
the behavior of some of our objects, and we used #doesNotUnderstand
to forward calls for non-modified behavior.

For example, our transaction object was used both in transaction
entry windows and report rows.  One of these transaction objects
could answer 50 - 80 questions, such as the total value of the
transaction, original value of the security, yield, term-to-
maturity, etc.

In the entry window, total value was always positive, as the
transaction type (buy, issue, deposite, withdrawal) would tell
us to add or subtract the amount from the cash balance of the
portfolio.

But in reports, users wanted to see the actual positive or
negative number in the total value column.  The transaction
itself had no context when asked for its value, so we added
a wrapper class that knew its context was a report row.
It returned the appropriate number for total value, and
forwarded all other messages to the transaction that it
contained.

There are at least two other ways we could have done this.
(1) We could have added special methods to the transaction
classes to handle this special case, and (2) we could have
added forwarding methods to the wrapper class.  The first
makes the transaction classes a lot harder to understand
(i.e. which methods are used in which context), and the
second adds a lot of busy work (as well as making the
image larger for no great benefit).

  Hope this helps!
  Alan
