Re: Observer pattern limitations
- From: "Leslie Sanford" <jabberdabber@xxxxxxxxxxxxxxxxx>
- Date: Fri, 14 Jul 2006 16:36:25 -0500
"Dmitry A. Kazakov" wrote in message:
On Fri, 14 Jul 2006 14:29:25 -0500, Leslie Sanford wrote:
Here is an example that can cause a problem:
---------------->
+---+out
| B |--+
+---+ |
+---+ out |in | in+---+out
| A |-------+ +---| D |---->
+---+ |in | +---+
+---+ |
| C |--+
+---+out
So how can this be solved?
[snip]
There exist other solutions as well.
1. In the data-flow language I designed, D is triggered by an
expression @B~@C, which has the semantics: "both time stamps have been
incremented." This kills the race condition between B and C.
2. In synchronous data-flow languages (my is asynchronous) like
Simulink, there is no problem at all, because D(n+1) takes B(n) and
C(n) from the state vector of the previous step.
This second one sounds similar to an another idea I've been toying with.
The components are placed in an array of lists. At each index in the
array, there is a list of components that process the signal at the same
step in the algorithm. So to run the algorithm, you iterate through the
array and iterate through the list at each index, instructing the
components to perform their calculation. In my above example, 'A' would
be at index 0, 'B' and 'C' at index 1, and 'D' at index 2.
So the code for running the algorithm could possibly look like this:
for(int i = 0; i < componentArray.Length; i++)
{
foreach(Component c in componentArray[i])
{
c.Calculate();
}
}
Is this close to what you've described?
.
- Follow-Ups:
- Re: Observer pattern limitations
- From: Dmitry A. Kazakov
- Re: Observer pattern limitations
- References:
- Observer pattern limitations
- From: David Barrett-Lennard
- Re: Observer pattern limitations
- From: H. S. Lahman
- Re: Observer pattern limitations
- From: David Barrett-Lennard
- Re: Observer pattern limitations
- From: H. S. Lahman
- Re: Observer pattern limitations
- From: David Barrett-Lennard
- Re: Observer pattern limitations
- From: David Barrett-Lennard
- Re: Observer pattern limitations
- From: Gabriel Claramunt
- Re: Observer pattern limitations
- From: Leslie Sanford
- Re: Observer pattern limitations
- From: David Barrett-Lennard
- Re: Observer pattern limitations
- From: Leslie Sanford
- Re: Observer pattern limitations
- From: Dmitry A. Kazakov
- Observer pattern limitations
- Prev by Date: Re: Poly Couples
- Next by Date: Re: Observer pattern limitations
- Previous by thread: Re: Observer pattern limitations
- Next by thread: Re: Observer pattern limitations
- Index(es):
Relevant Pages
|