[clug-progsig] Keeping Status
Shawn
sgrover at open2space.com
Thu Feb 8 05:23:50 PST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Related to this: How can I tell when all the async processing has been
done?? (I think I can see a couple ways to determine this, but it's
SOOO closely related, I thought I'd see what you have to say.. :)
Shawn
Shawn wrote:
> This weeks challenge... :)
>
> I have a number of objects, some of which will work asynchronously, and
> almost all of them can have different states at any given time while
> processing is happening. I need to be able to display the "current"
> status, but the asynch and multi state issues are causing grief.
>
> So, I'm looking for ideas.
>
> The model is something like this:
>
> objectA
> objectA.arrayB (contains objectB's)
>
> objectB
> objectB.objectC
> objectB.arrayD (contains objectD's)
>
> objectC
> objectC.arrayE
>
> objectD
> objectD.arrayE (yes, same type of object as objectC's array)
>
> So, when objectA loads, it get's it's list of objectBs.
> Then each objectB is told to get it's data, and so on.
>
> Each object is operating asynchronously. So, I can't just set a global
> status flag. (objectX might still be loading, but objectY may have
> cleared the status, which is not indicative of what's really happening
> at that point in time).
>
> I've tried to give each object a "state" queue, which is a simple array
> of messages and timestamps. Then objectA displays the latest "state" as
> it's status, and each time a state is changed, it calls the routine to
> redetermine the current state. Unfortunately this isn't working well.
>
> I thought about using an observer pattern, but am not quite sure that's
> the right answer here, and it could have substantial impact on the code.
> (seeing as it wasn't written with an explicit pattern approach)
>
> I've been trying to resolve this for the past 4 hours, and I can't help
> but fell my approach is just wrong. So I'm looking for alternatives.
> Any suggestions are appreciated.
>
> Shawn
>
> (NOTE: the above problem has been highly simplified for the purpose of
> posting here. In some ways it's not quite as complex, and in other ways
> it's MUCH MUCH more complex... :)
>
>
>
>
>
_______________________________________________
clug-progsig mailing list
clug-progsig at clug.ca
http://clug.ca/mailman/listinfo/clug-progsig_clug.ca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFyyRmMia5XCIAQC8RAkfKAJ0flP3yIcmMi2JN8bJ0pE6bFiDZtwCfaHzD
YmxYV1D4/7A3rnL0I6l48o8=
=XjPF
-----END PGP SIGNATURE-----
More information about the clug-progsig
mailing list