Subject: Re: Trouble with labels
From: Erik Naggum <erik@naggum.net>
Date: 12 Apr 2001 13:44:14 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3196071854975641@naggum.net>

* Paolo Amoroso <amoroso@mclink.it>
> I have a design question: why do you keep the code for checking for the
> appropriate balance in a separate :AROUND method instead of adding it to
> WITHDRAW's primary method? I can think of a few reasons:
> 
> - because performing a withdrawal and checking for an appropriate balance
>   are orthogonal operations
> - for improving modularization, i.e. for making it easier to later add
>   other validation methods
> - to emphasize a WITHDRAW protocol

  All of the above, some of which I think of only after you suggest them. :)

  However, my initial reason for doing this was to show that you might want
  to deal with credit limits without modifying the core operation.  In real
  life, a withdrawal that requests credit is an automatically granted loan,
  with a lot of background work to deal with the loan.  So a :before method
  that took care of the credit approval would update the balance before the
  withdrawal updated it again.

  Anyone who has had to deal with accounts with real money in real life
  knows that the first principle that you never violate is that you never
  affect the money supply.  Maintaining that invariant is hard work in
  banking applications.  Much of the complexity in database transactions
  come from banking requirements not to create or destroy money, no matter
  what happens.

#:Erik
-- 
  I found no peace in solitude.
  I found no chaos in catastrophe.
			-- :wumpscut: