Difference between revisions of "OTExample Observer"
Line 1: | Line 1: | ||
'''This is a reusable implementation of the omnipresent design pattern "Observer".''' | '''This is a reusable implementation of the omnipresent design pattern "Observer".''' | ||
− | Note, that a well designed program in Object Teams will usually not require an explicit Observer infrastructure. See the [[OTExample_Stopwatch | Stopwatch]] example for an example, how a plain callin-binding suffices. | + | Note, that a well designed program in Object Teams will usually not require an explicit Observer infrastructure. See the [[OTExample_Stopwatch | Stopwatch]] example for an example, how a plain callin-binding ({{{Otjld|4}}}) suffices. |
This demo should, however, give a quick understanding to some techniques of Object Teams for all who are familiar with the Observer pattern (''the OTDT ships with a simpler version of this pattern''). | This demo should, however, give a quick understanding to some techniques of Object Teams for all who are familiar with the Observer pattern (''the OTDT ships with a simpler version of this pattern''). | ||
Line 11: | Line 11: | ||
<td>'''This implements the GoF pattern very straight forwardly.''' | <td>'''This implements the GoF pattern very straight forwardly.''' | ||
Open spots are: | Open spots are: | ||
− | * method | + | * method Subject.changeOp which should be triggered at relevant base-level events |
* and the abstract method Observer.update() which should realize the Observer's reaction.</td> | * and the abstract method Observer.update() which should realize the Observer's reaction.</td> | ||
</tr><tr> | </tr><tr> | ||
Line 23: | Line 23: | ||
:ObservingOpen | :ObservingOpen | ||
:ObservingClose</td> | :ObservingClose</td> | ||
− | <td style="vertical-align:top;">'''Two applications of the Observer pattern binding the above open spots using callin and callout bindings. | + | <td style="vertical-align:top;">'''Two applications of the Observer pattern'''<br> |
+ | binding the above open spots using callin ({{{Otjld|4}}}) and callout ({{{otjld|3}}}) bindings.</td> | ||
</tr><tr> | </tr><tr> | ||
<td>flower_example/ | <td>flower_example/ |
Revision as of 07:09, 23 February 2010
This is a reusable implementation of the omnipresent design pattern "Observer".
Note, that a well designed program in Object Teams will usually not require an explicit Observer infrastructure. See the Stopwatch example for an example, how a plain callin-binding (4) suffices.
This demo should, however, give a quick understanding to some techniques of Object Teams for all who are familiar with the Observer pattern (the OTDT ships with a simpler version of this pattern).
protocol/
|
This implements the GoF pattern very straight forwardly.
Open spots are:
|
flower_example/
|
Implement some base entities |
flower_example/
|
Two applications of the Observer pattern binding the above open spots using callin (4) and callout (3) bindings. |
flower_example/
|
A simple main program |