Design Patterns
Here are some of the best practices we are using in RadGrad.
Use exported constants instead of Strings
An example of this is in RadGrad2's redux directory. Each type is an exported constant.
We are using the exported types instead of strings to ensure there are no typo errors.
Publications and Subscriptions
The BaseCollection
defines default publish
and subscribe
methods.
We publish and subscribe to the entire collection. In the subscribe
method we return the handle to the subscription, so the client can wait till the subscription is ready. We use the optional userID
parameter to support filtered collections such as the CourseInstanceCollection
:
When the client subscribes to the CourseInstanceCollection they can supply the userID to only get the Course Instances for that user.
If a client wants to subscribe to the Course Scoreboard, they use