Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ER for Subjects and Observers
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
ER for Subjects and Observers
Miscellaneous
Thread ID:
00659577
Message ID:
00659577
Views:
71
I mentioned the idea a little while ago about enhancing Subjects & Observers so that they could be used to communicate between machines over the network. I've looked at the code a little closer and a few things would probably have to be changed in these classes for this to work.

Currently, the CObserverMgr class passes the observer object reference to the CSubject class. Then when something occurs, the CSubject's Notify() method cycles through this collection and calls the CObserver's Update() method. This works fine when the subject & observer are running on the same machine/instance of the app since you actually have an object reference you can pass around.

Instead of this approach (which I'm sure is faster), it might be more flexible to move this functionality back up to CObserverMgr, and let it handle the communication. Then it could either communicate with a local object reference (if it exists) and add/update an entry into a shared table on the network.

Each subject would create (via CObserverMgr) it's own entry in the table for each of it's possible states (unless they already existed). Then, when a state change occurs, CObserverMgr looks up the appropriate cType + cState and updates the dtLastUpdate field.

The shared table could be something as simple as:

cType
cState
dtLastUpdate

CObserverMgr could also be enhanced to poll this shared table every N seconds to look for any events that it's local collection of observers might be interested in.

Any thoughts?
-Paul

RCS Solutions, Inc.
Blog
Twitter
Next
Reply
Map
View

Click here to load this message in the networking platform