Use Case Diagram for Stack Overflow

Learn how to define use cases and create the corresponding use case diagram for the Stack Overflow problem.

Let’s build the use case diagram of Stack Overflow and understand the relationship between its different components.

First, we’ll define the different elements of our Stack Overflow system, followed by the complete use case diagram of the system.

System

Our system is "Stack Overflow."

Actors

Now, we’ll define the main actors of Stack Overflow.

Primary actors

  • User: This actor can create, answer, and flag questions. This actor can add bounty, tags, and comments to questions, and vote to close or delete questions or answers.

Secondary actors

  • Guest: The guest can only search and view questions and their answers but needs to register an account to ask and answer questions.

  • Admin: The admin is in charge of performing numerous operations, such as blocking or unblocking users.

  • Moderator: The moderator is in charge of performing numerous operations, such as closing, reopening, deleting, and restoring questions.

  • System: This is responsible for awarding badges to users and sending out notifications whenever a new answer is added to a question asked by a user.

Use cases

In this section, we’ll define the use cases for Stack Overflow. We have listed the use cases according to their respective interactions with a particular actor.

Note: You will see some use cases occurring multiple times because they are shared among different actors in the system.

User

  • Login/Logout: To log in or log out from the Stack Overflow account

  • Reset password: To reset the password of the Stack Overflow account

  • Add/modify/flag question: To create a new question or modify or flag an existing question

  • Add/modify/flag answer: To create a new answer or modify or flag an existing answer

  • Add comment: To add a comment to a question or answer

  • Vote to close/delete question: To vote to either close or delete an existing question

  • Upvote/downvote: To either offer support or register disapproval for a post

Guest

  • Search/view question: To search for a question from Stack Overflow and view its contents

  • Register account: To register an account

Admin

  • Block/unblock user: To block or unblock a user

Moderator

  • Close/reopen/delete/restore question: To close or delete an existing question, reopen a closed question or restore a deleted question

  • Delete answer: To delete an existing answer

System

  • Award badge to a user: To award an earned badge to a user

  • Send notification: To send a notification if any new answer or comment is added to a question followed by a user, and if there is an upvote or downvote on a question/answer

Relationships

We describe the relationships between and among actors and their use cases in this section.

Generalization

  • "Moderator" has a generalization relationship with "User" as the moderator can perform all those tasks that a normal user can perform.

  • "User" has a generalization relationship with "Guest" as the normal user can perform all those tasks that a guest user can perform.

Associations

The below table shows the association relationship between actors and their use cases.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.