nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

UML Class diagrams for Event-driven architectural style? #278

Open AngJunYang opened 1 year ago

AngJunYang commented 1 year ago

Unrelated to tp/dg, but was reading about Event-driven architectural style, and got curious how we would represent these in any of the UML diagrams we know.

Since the parties responding to the event trigger may not be known, or may only be assigned at runtime, it doesn't seem too easy to be able to make a diagram for it.

How would one go about trying to represent these in Class diagrams, Object diagrams etc..?

damithc commented 1 year ago

@AngJunYang You can checkout the UML diagrams used in explaining the Observe pattern https://nus-cs2103-ay2223s2.github.io/website/schedule/week11/topics.html#design-design-patterns-observer-pattern-what

While not exactly the same, the Observer pattern is somewhat of 'event-driven' nature in that <<Observer>> objects get notified when something happens to the <<Observable>> objects.

In general, given that the purpose we use UML diagrams is to explain/communicate only, if a situation has many variations and uncertainty (e.g., some things decided at runtime), you can always narrow the scope when drawing the diagram i.e., draw the diagram for a selected variation (of many possible variations).