Re: Programming to an Interface



Laurent Bossavit wrote:
Bernard,


Could you please transform this example to "programming to an
interface", still in Ruby to allow us to compare?


(In the original, btw, I meant "account.getId" rather than "amount.getId"...) In Ruby, perhaps we could come to:

def debitAccount amount
transaction = makeTransaction()
transaction.execute(this) {balance -= amount}
end

That is, the mechanics of persisting changes to an object and wrapping the business logic in a transaction would be hidden at the next level down. You don't care how persistence or transactions are implemented, only that you can rely on both.

Laurent

You'd probably want:

def debit_account amount
transaction do
balance -= amount
end
end

I fail to see how this has anything to do with programming to an interface rather than implementation though.

Joe
.



Relevant Pages

  • Re: TDBC documentation, examples, syntax?
    ... interface usually provides enhanced features). ... The goal of TDBC is to define the Tcl parts of the interface and get ... useful than nested transactions: transaction boundaries. ... push this problem onto the "driver programmer". ...
    (comp.lang.tcl)
  • RE: Assigning Duplicate Values
    ... and numbers transaction amounts, and the colors are account numbers, I simply ... As an alternative I started looking at doing a count by dollar amount, ... Posting Year Posting Month Month Day Year GL Ref# Amount GL Account ...
    (microsoft.public.access.queries)
  • Re: Visa Debit Payment
    ... credit cards isn't always the amount entered on the card terminal. ... Sometimes the debit aquires a '0', ... Sainsburys are aware that an equal number of transaction ... I do my card reconciliations two working days after the transaction. ...
    (uk.legal)
  • Re: running balance
    ... LASTAS debit, ... LAST(a.[Deposit Amount]) AS credit, ... GROUP BY a.[date of transaction] ... amount in the credit, if applicable). ...
    (microsoft.public.access.queries)
  • Re: Transaction based testbench - Effective encapsulation of the client transactors?
    ... I implement the transaction source in a single model I ... a given interface I make calls to the transaction procedures. ... Handshaking between the test control and the ... BFM can be anything you like. ...
    (comp.lang.vhdl)