Search code examples
classumlassociationsclass-diagrammultiplicity

Drawing UML class diagram for a blogging system


I'm trying to draw the correspond UML class diagram of the use case diagram of a simple blogging system, which is displayed as follows: enter image description here

To draw the class diagram, there should be two classes: User and Blog. But I have difficult drawing the association between them because there could be two different multiplicities in the relations between those two classes. For example, when user create a blog, the class diagram would look like this: enter image description here

But in terms of user viewing blog, the multiplicity is different as a certain blog can be viewed by not only 1 user, so the class diagram would look like this: enter image description here

So how can I solve this issue in solution domain?


Solution

  • In addition to Thomas' answer:

    • One sure thing is the structural 1 to many relation between User and Blog. But this is more implicit knowledge than use-case analysis: your system MUST keep track of the link of a Blog and the User who created it, so to enable him also later updates and deletes.
    • However, many blogging systems also keep track of the Blogs that a User did consult (to measure audience, to keep track of history, etc...). So your system COULD also keep track of the viewing (but it could also work without).

    enter image description here

    You could show the navigation arrow. But in your system, the navigation will certainly be bidirectional.


    A more systematic approach to the use case analysis is to use the entity- control-boundary approach, and use the following classes for the design:

    • Entities: persistent data: Blog and User as above
    • Boundaries: link between a use case and actors: CreateOwnBlog and ViewBlog
    • Control: mediating classes between the two worlds: ViewingSubsystem and AuthoringSubsystem