Skip to content

Commit 93673f9

Browse files
committed
#88 feedback from team
1 parent 277c1a5 commit 93673f9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

doc/phet-software-design-patterns.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ PhET widely uses the observer pattern described in https://en.wikipedia.org/wiki
702702
##### Role in MVC
703703
Please see the [Model-View-Controller (MVC)](https://github.com/phetsims/phet-info/blob/master/doc/phet-software-design-patterns.md#model-view-controller-mvc) section of this document for context.
704704

705-
In short, the observer pattern acts as a key communicator within the model-view hierarchy of PhET simulations. The model is oblivious to the view, so the model uses the observer pattern for the view (which has a reference to the model) to observe the state of the model and correctly render a mirrored view representation.
705+
In short, the observer pattern acts as a key communicator within the model-view hierarchy of PhET simulations. The model is oblivious to the view, so the view uses the observer pattern for the model to observe the state of the model and correctly render a mirrored view representation.
706706

707707
See for example:
708708
```js
@@ -787,8 +787,6 @@ PhET widely uses the observer pattern described in https://en.wikipedia.org/wiki
787787
#### [Multilink](https://github.com/phetsims/axon/blob/master/js/Multilink.js)
788788
Multilink is a convenience class that is used to observe multiple Properties with the same observer functionality. Similar to DerivedProperty, it has its "dependencies" of Properties, and when any dependency's value changes, the observer is invoked with the values of the dependencies in corresponding order. However, it is *not* a subclass of Property and doesn't conform to the Property API.
789789

790-
Note that Multilinks are not created through its native constructor. Rather, they are created through static creator methods of Property (`Property.multilink` and `Property.unmultilink`).
791-
792790
##### Other Notes
793791
- In some use cases of `Multilink` and `DerivedProperty`, the observer needs to know which Property caused the notification. One solution is to add independent listeners to each dependency and turn the DerivedProperty into a Property that is modified by each listener. Please reference https://github.com/phetsims/axon/issues/259.
794792

@@ -817,9 +815,7 @@ ObservableArray is another common iteration of the Observer pattern. ObservableA
817815
#### [Emitter](https://github.com/phetsims/axon/blob/master/js/Emitter.js)
818816
You may see `Emitters` used in the common code shared between simulations. Emitters are a generic event-based class that follows the observer pattern to allow clients to subscribe (through the `addListener` method) to a single specific event.
819817

820-
Usually, Emitters are not needed in sim-specific code, and most of PhET's observing can be achieved with the classes outlined above.
821-
822-
#### Events
818+
#### Input Events
823819
Another form of PhET's version of the Observer pattern is through user-triggered events, such as dragging, clicking (pressing), etc. This is all done through the scenery input system.
824820
825821
Scenery Nodes support `FireListener`, `DragListener`, `PressListener`, etc. Listeners subscribe to when the user does a specified event, which may alter the simulation. Listeners are often passed a [SceneryEvent](https://github.com/phetsims/scenery/blob/master/js/input/SceneryEvent.js).

0 commit comments

Comments
 (0)