Menu

#12 Improve Observer to handle complex dependencies

1.0.3
open
None
5
2010-03-25
2010-03-25
No

Improve the Observer Pattern implementation to support complex dependencies in UI applications e.g.Swing-based. Suppose there is a UI with many widgets that have complex inter-dependencies e.g.

widget "b" computed value depends on widget "a" value
widget "c" computed value depends on widget "a" value
widget "c" computed value depends on widget "b" value

Suppose this inter-dependencies are implemented in the design using the Observer pattern in this case widget "c" will be notified whenever widget "a" changes or widget "b" changes but this is not efficient ... the worst is that the notification to widget "c" can happen before "b" gets updated so that the state of "c" is temporarily "dirty"

A solution to this problem is to improve the Observer implementation with Topological Sorting based on these complex inter-dependencies so that "c" widget is notified only once and when all the widgets it depends upon have been updated.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.