Use Case Diagrams in Software Engineering

What is use case?

A use case is an event or action with reference to user/actor of the event/actions that should be performed through the software.

What is use case diagram?

When we represent use case and their interaction with actors/users through the UML(Unified modeling language), then this kind of modeling is use case diagram.

Relationships among use cases:

Extend: There is an optional relationship among use cases.

Include: There is a compulsory relationship among use cases.

Inheritance: Some variables, functions or some other things are inherited from one use case to another use case.


Example 1:

Case Study:

You need to develop a social networking website with following functionalities; First of all, the user should create his account. After that user can log into the system and can change his profile picture. The Registered user should also be able to search a friend. After searching a friend user can add friend.

Solution:

Figure 1 represents the actions of a social website.

Use case: Register, Log in

The user should register. After register user can log in the system. So it means that register is must to get a login(included). The direction of the arrow represents that “register” is compulsory before “login”.

Use case: Login

once the user creates an account, now the user can log in every time without “signup”. So we also draw a direct arrow from user to login(extend).

Use cases: Login, Upload profile picture

When user gets login, now there is a choice for the user, that user can upload a profile picture or not. Totally depends on the choice of the user(extend).

Use cases: Login, search friend

When user gets login, now there is a choice for the user, that user can search friend or not(extend).

Use cases: Search friend, Add friend

When user gets login, now there is a choice for the user, that user can search friend or not(extend). When user searches a friend, then there is an option that user add a friend or not(extend). But when user adds friend then its must that user should first search the friend(included).


Example 2: 

Case Study:

You need to develop a web-based application with following functionalities; User can buy products online by placing the online order. The user can pay the bill by credit card or through Paypal.

This diagram represents inheritance among use cases. Place order is parent use case and pay through PayPal and pay through credit card are child use cases. It means that some of the variables, functions are something else is inherited from parent to child.

inheritance in use case diagram
Figure: inheritance in use case diagram
  • Place order is parent use case.
  • Pay through Paypal is child use case
  • Pay through credit card is child use case

Variables, functional and all kind of data etc that is set as protected, can be accessed from parent to child use case. For example, here anything can be inherited from place order use case to pay through pay and pay through credit card.


Example 3: 

This diagram represents inheritance among use cases. authentication is parent use case and authentication by finger authentication by info are child use cases. It means that some of the variables, functions are something else is inherited from parent to child.

 

 

Use case diagram inheritance examples
Figure: inheritance in use case diagram
  • Authentication is parent use case.
  • Authentication by fingerprints is child use case
  • Authentication by info is child use case

Variables, functional and all kind of data etc that is set as protected, can be accessed from parent to child use case. For example, here anything can be inherited from authentication use case to authentication by fingerprints and authentication info.