[Haskell-cafe] Incremental trasnformations (not Haskell topic)
frantisek.kocun at gmail.com
Fri Dec 19 15:26:32 EST 2008
Hi, this is not a Haskell question but I'm not sure if anyone in java
community can answer this. And I'm sure every Haskell programmer know OO
programing. I'm programming one big boring db application and making a MDD
tool to model and generate such applications.
Many times object have computed attributes:
E.g. value attribute of class Invoice is sum of values of all associated
classes Item (Invoice 1 <>---> * Item)
So value attribute of invoice is computed every time it is demanded. So far
easy.Sometimes it is necessary not to compute it when it is needed but to
have it precomputed (computed it every time, item is added/removed to
invoice or item value is changed). Contract of attribute value is the same
but it is not obvious from code if you program it in event-based as if you
program it with expression which is computed every time. Event-based=no big
picture. Expression=big picture but little performance.
Is there any way how to transform the OO transformation (invoice value is a
sum of values of items) to incremental transformation (update invoice value,
when item is created/deleted/changed)? Is there any product doing it. I am
not interesting in product itself I want only see how it works? Is there any
science paper on this?
I call this not a function but a OO transformation because it can be much
more complicated. I know it is not possible for all the functions
(transformations), you have to do undo step, but it is possible for that
what we use.
One more complicated example:
Provider provides money to receiver. It provides money with special code.
Receiver sees all the money from all the providers grouped by the code and
summed. Every summed group on the code has a subgroup summed on the
Provider A provides to R 10 on code "ABC"
Provider A provides to Q 10 on code "ABC"
Provider A provides to R 5 on code "ABC"
Provider A provides to R 20 on code "DEF"
Provider B provides to R 30 on code "ABC"
Reciever R - recieves 45 on code "ABC", 15 from A, 30 from B
- recieves 20 on code "DEF", 20 from A
Reciever Q - recieves 10 on code "ABC", 10 from A
This example can be easily programmed declarative way in Scala the way that
everytime everything is computed. But have no clue if it can be transformed
automatically to incremental way.
Hope you understand what I mean.
Thanks for your help and opinions
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe