General information
Category:
The Mere Mortals Framework
>I'm working on a bit of code that will involve two different bizobjs and I'm looking for suggestions on how to design the interaction (I can make it work, but I'd like to make it as "elegant" as possible).
>
>Here's the scenario:
>
>-Each invoice can have it's own set of rates.
>-When a new invoice is create I copy the rates from a "master" table into an "InvoiceRates" table
>-Each line in the invoice is linked to a record in the "InvoiceRates" table
>-I have an object called LineRatesObj
>-- This object has an AddRates() / DeleteRates() method that copies (from the "master")/deletes rates in the "InvoiceRates" table
>- I have an InvoiceLinesObj
>
> At some point, the user can decide to change the rates for the invoice. This would mean I'd have to AddRates() to the InvoiceRates table, DeleteRates() for the old set of rates, then relink the invoice lines to the new rates.
>
>Which object should be resposible for this? Should I add a ChangeRates() method to my InvoiceLinesObj, then in there create an instance of LinesRatesObj and access it's methods (or do this in InvoiceLinesObj instead)? Either way seems "wrong" (although functional).
>
>Is this a place where I should use an Event?
Paul,
I just started playing with events. They add another layer of complexity, but at the same time they can simplify how bizobjs can talk to each other when you have multiple bizobjs interacting together. I would definately create a ChangRates event to coordinate all the objects. The logic for the event can be handled inside the event, but each bizobj would be responsible for handling its own logic for updating the cursor. Give it a shot.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only