USE CASE DIAGRAM
Use case diagram is high level static UML (Unified Modeling Language) diagram
A use case diagram is a visual representation that how user or external interface interacts with a system not the functionality of system.
Use case diagram is modelled as per end user prospective
In Use case diagram time factor is not modelled ,it high level features those need be incorporated into the proposed system without establishing control flow of actions
E.g In use case diagram we show customer after making payment gets transaction receipt but customer may gets error by providing wrong card details
Use Case diagram has 4 major components
System: A system consist of screens, control units,databases and third party plugins . The system is shown by a rectanglular box. System name is written on the top side and inside the system . All use cases are mentioned within the system only and actors are kept outside of system
Actor: Actor is a user or another system or a hardware or an entire organization that interacts with system.Actors are shown outside of system and represented by stick people and named using Noun.
There are two types of actors:
Primary Actor – A primary actor initiates the interaction with the system and kept on left side of system. All primary actors are placed on the left side of system
Secondary Actor – Secondary actor may provide a service to the system and also supports primary actor to interact with the system and all secondary actors are placed on right side of system
Use case –
Use cases are used to represent high-level features of system defined by stakeholders. It is denoted by an oval shape with the name of a use case written inside the oval shape..Use case represented by verbs
Essential use cases – which make sense and completeness to the end user
Supporting use cases – Essential use cases can be supported by Supporting use cases
Essential use case – “ Order the food” from online food delivery app
Supporting use cases – Login, search restaurant, search food menu, payment, delivery of food
Association – lines which drawn between use cases and actors and shows actor-use case relationship
Steps to draw Use case diagram –
-Identify sequence of actions of proposed system
-Convert all actions into essential use cases and supporting use cases and mention them within the system
-Identify primary and secondary actors
-Identify actors performing above actions
-Draw appropriate relationships between use cases and actors
-We generally don’t model system names like laptop or desktop ,database names, networks,technology names
RELATIONSHIP IN USE CASE DIAGRAM
Use cases share different kinds of relationships. A relationship between two use cases is basically a dependency between the two use cases (parent-child)
When a use case is integral part of another use case in a diagram, this relationship between the use cases is named as an include relationship. An include relationship is represented with a dotted arrow.
Include is used between the essential (parent) use cases and supporting (child) use cases, include is used when the supporting uses are mandatory to essential use cases.
Include relationship is denoted by <<include>>
For an example, you can see that the action defined by the “Generate transaction ID” use case is contained within the “Make payment” use case. Hence, whenever the “Make payment” use case executes, “Generate transaction ID” use case are also executed.
In an extend relationship parent use case exist without child use case and child use case adds the value to parent use case
In an extend relationship between two use cases, the child use case is optional and not mandatory
An extend relationship is represented with a dotted arrow, similar to the include relationship.
Extend relationship is denoted by <<extend>>
Example – toppings on pizza is optional but adds value in pizza
A generalization relationship is also a parent-child relationship between use cases.
In generalization relationship child use case have all characteristic, behaviour, attributes of parent use case or we can say child class takes the instance of a parent
Parent use case exist with one or more child use cases
In a use case diagram, generalization is shown as a directed arrow with a triangle arrowhead.
The child use case is connected at the base of the arrow.
The tip of the arrow is connected to the parent use case.
Example – “Debit card” payment or “credit card” payment is a type of parent use case “payment” and they show characteristics of main or parent class.