On Jun 26, 5:32 pm, Raoul Duke <
rao...@gmail.com> wrote:
> model A calling upon model B to turn gears and spit
> out and answer doesn't sound a lot different than
> object A calling upon object B in some similar fashion.
Scale it up! Two is a too-small number to see complexity issues due to
mismatch, Raoul.
Perhaps an example will help. Based on a case mentioned earlier:
We want to model a candle burning in a closed room and make
predictions such as:
* How tall is the candle at a given moment in the future.
* How are the surfaces coated with wax and soot.
In addition, we also wish to tweak parameters and learn features like:
* How does the size of the room affect the rate of burning (e.g. due
to changes in ambient temperature - which may affect the wax, oxygen)
* How does the position of the candle in the room (e.g. near a wall or
corner) affect the rate of burning and the distribution of wax and
soot.
* What if we have more than one candle and put them near one another?
* What if we change the shape of the candle?
* What if we open one wall, a window, or the ceiling?
* What if the walls have a severe initial temperature differential?
* Does spinning the room make a difference?
Now, attempting to use Objects for modeling (as opposed to an assembly-
language for creating models that should really be glued together by a
compiler or interpreter) would typically involve:
* Creating a candle object, with an initial property like height.
* Adding a clock object, and hooking the clock object to the candle.
* Setting the candle up to modify its height and create soot-and-wax-
particle objects with each tick of the clock.
* Those soot-and-wax-particle objects need to go somewhere, so we add
a 'room' object and hook it to the candle so the candle knows where to
push the soot-and-wax-particle objects.
* Hooking room to time and soot-and-wax-particles so we can move them
around and coat surfaces.
* Add some oxygen-content to the room.
* Set the candle up as a consumer-of oxygen over time.
* Modify burning rate based on ambient concentration of oxygen.
* etc.
Note that as soon as two or three 'objects' are in a 'model', dataflow
is involved. Worse, it's totally interconnected: clock hooks to
everything, candle hooks to everything, room hooks to everything, etc.
The fact that these objects can 'call upon' one another doesn't help
reduce the complexity. As we add each element to the model (a spinning
room, a window, etc.), nearly every single behavior needs to be
updated.
If we wish to abstract the candle so we can use many different shapes,
that is possible, but the candle must still have dozens of 'hooks'
into its programming environment to obtain the information it
requires. This is a severe breakdown for using objects for modeling -
essentially an inversion on the encapsulation-of-data requirement,
each object calling upon all the other objects to make local updates,
and no reuse for any of these objects in a slightly different
environment because each new addition or tweak to the model now
requires hooking in ever more objects.
The complexity involved is one of mismatch impedence. We attempted to
use objects for modeling when, fundamentally, objects are the
antithesis of models. Where a model predicts or analyzes behavior, an
object dictates or synthesizes it. Where a model draws upon data and
other models passively and processes it implicitly via a common logic,
an object must actively request or attach to data sources and decide
how to process it locally.
If we used a modeling language for models - a DSL, or logic
programming - we could achieve composable models, allow easy derived
models, automatically derive which pieces are related and need to be
hooked together, and build the appropriate system behavior. All the
Objects aren't Models. They aren't bad assembly components for /
implementing/ models, though, so compiling a logic program into an OO
program isn't unreasonable.
> when i say that OO doesn't have to be "push" i don't
> immediately think of / know enough to see it as
> meaning "OO implementing dataflow".
You'll learn. ^_^