Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Live Notifications UML Class Diagram

I am trying to implement a live notification system (like fb, xing, twitter..). Therefore, I created an UML class diagram before building the entities. The showcase is the following:


EDIT: I Thought about this approach and it seems as if this is not the right one. Let's check the following scenarion: User U adds at Event E's image I a comment C. How to store this correctly, I mean EventNotification only has a reference on the Event E, but not on I and C. Therefore I would need to create an "EventImageNotification" class as well and this would be a mess. Would it be a nicer solution to just have one "Notification" class and add a "metadata" field to it, which stores references to all involved fields?


(I am using an OR-Mapper to implement relations later).

[ 1 ] One user can create events, e.g. "Silvester Party 2015". (OneToMany). This event has a dashboard, where Users can subscribe to receive updates when the creator posts something on that event (ManyToMany).

[ 2 ] When a user posts something on the dashboard of the event, subscribed users should receive a Notification. Therefore, I created the EventNotification class. Relation between user and EventNotification is ManyToMany.

[ 3 ] To keep it clean, I created an AbstractNotification class which is related to a Notification type. A notification type is something like name = "EventPost" and template = "User user has posted something new on event __event".

[ 4 ] The abstract class NotificationConnector gives fields to the mapping class between EventNotification and User (UserEventNotification). I created them to extend it easily in the future, e.g. a User can create Books that also trigger events etc. Then I would need to create one "BookNotification" and one "UserBookNotification" class to store notifications for this new entity.

Is this approach a good one or fully messed up? Please tell me your ideas about this diagram:

(The arrows to build associations should have been normal lines, the tool I used just couldn't do that).

Notification UML

like image 296
user3746259 Avatar asked Oct 13 '15 12:10

user3746259


1 Answers

Just a few observations:

  • The two abstract classes seem to be superfluous since you use them only in one context.
  • The hasconnection from User should go to UserEndNotification rather than the abstract class (which I recommend to drop anyway).
  • I'd make NotificationType an <<enumeration>>
  • rather than using an owns relation I would use an association class between User and Event and add an isOwner and isSubscriber property.
like image 152
qwerty_so Avatar answered Dec 17 '22 09:12

qwerty_so