Re: Questions about CLOS



Justin Paston-Cooper <defcon8@xxxxxxxxx> writes:
Hello. I'm trying to think of a way to implement interest rates on
bank accounts. Each time withdraw, credit or is called, I would like
it to be checked whether interest should be added to the account. Or
maybe another solution is better.

If one does direct slot accesses, I don't think there is any way of
doing it.

However, if an interest check was done as :before method of its
'balance' reader method, it seems to be sufficient.

I would think the correct interest accumulation is only needed
as a part of a some operation that checks the balance. Otherwise,
the operation is not dependent on it, and the fact that the instance
has not actually been updated is of no concern.

The only issue is that, there may some other slots in the account
instance that are dependent on the balance, and updated when the balance
is changed. Their reader methods might also need to do an interest
check.

This might cause a lot of interest checks, however, a simple check of
the date against a precomputed date of the next interest change
could be relatively inexpensive.
.



Relevant Pages

  • Re: Really bad table design...
    ... there could be two membership fees at the start of every year ... The balance forward system simply lists all these, ... > dues are paid once a year based a pre-set date for all board members. ... >> and account activity, ...
    (microsoft.public.access.tablesdbdesign)
  • Interest rate offer "bait and switch"?
    ... I took advantage and transferred 5k to the account ... which was at a zero balance. ... started all over at 5k minus the charges etc but it didn't add up or balance ... Capital One Credit Card Offer ...
    (misc.legal)
  • Re: Egg Money
    ... In other words, if it *is* a single account, I would not really ... appeared in the -ve balance column with nothing in the +ve. ... another purchase *and* paid some money in. ... "Egg Money customers will get up to 50 days' interest-free credit on ...
    (uk.finance)
  • Re: Egg Money
    ... My wife has recently opened an Egg Money account - which I understood to ... 50-odd days interest free credit on credit card purchases. ... a +ve and a -ve balance. ...
    (uk.finance)
  • Re: writing a class
    ... > initial starting balance, amount of deposits, amount of withdrawals. ... > from Account import Account ...
    (comp.lang.python)