Use case model is a high-level abstraction of the interaction model. Use case model defines how the users interact with a system and what functional behavior does the system offers to its users.
Use case model shows the graphical representation of how a user interacts with the system to get a solution to a particular problem for which the system is designed. In this section, we will be discussing the use case model in brief along with its model elements.
Content: Use Case Model
What is the Use Case Model?
Use case model is a fundamental aspect of object-oriented analysis technology. A use case model describes the system from a user’s point of view. The use case model focuses on what the system does instead of how the system does.
The use case model helps the developers developing the system, in identifying what the user wants from the system and how the system should respond to the user’s requirement. So, the use case model shows the user and systems interaction.
Elements of Use Case Model
Each model has the modelling elements using which it is designed. The use model has some important modelling elements which are discussed below.
Actors are the one who directly interacts with the system to accomplish a certain goal. An actor can be a person, a device or the other system. An actor is an object or group of objects that behave in a particular way towards the system.
A system may have several actors, it identifies the actor depending on its behavior. Like, for a vending machine, a customer and a repairing technician both are persons but both behave as different actors for the system. For a computer system, the actors are users and administrator.
So, an object can be confined to behave as multiple actors towards the system. In object orientation an object or class can be defined for many different purposes. But, in the use case model, every actor has a well-defined purpose.
This can be understood by the example that though many different persons interact with the vending machine, the machine would categorize them as two actors i.e. customer or repairing technician.
In the use case model, the actor is one who has direct interaction with the system. If an object has an indirect interaction with the system it should not be considered as part of the system model.
As a repairing technician interacts directly with the vending machine so he is an actor for a vending machine but the one who has dispatched the technician from the service bureau do not have direct interaction with the vending machine. So, the dispatcher would not be considered as an actor to the vending machine.
The use cases in the use case model are the interactions between the actors and the system. It can also be summarized as functionality that a system offers to its actor is a use case.
When a customer actor interacts with the vending machine, the use cases would be ‘buying a beverage’. Now a use case may involve one or more than one actor for sure along with the system itself.
For example, a customer buying a beverage involve the customer and the vending machine. While in a telephone system when a user makes a call, it involves two actor’s caller and a receiver. It’s not that in a use case every time the actor will be a person it could be a device or another system as well. Like, when you purchase a stock on an online stock broker. Then the actor would be you as a customer, and a stock exchange. The stock broker system will have to interact with both customer and stock exchange to make a trade.
A use case has a sequence of messages that are shared between the system and its actors. Consider a use case ‘buy a beverage’ on a vending machine. This use case would involve the messages like at first customer inserts a coin, then vending machine displays the deposited amount, the customer then selects the beverage, vending machine dispense the beverage along with change if remaining.
Use case also includes error condition. For example, the customer has selected the item that is out of stock. So, the warning message will be displayed. Or the transaction that has been cancelled as after submitting the coin and before making any selection the coin return.
Such behavior is considered as an error by the customer. For such an error condition, the designer must plan the behavior sequence. For a system, the errors are the additional behavior that the system could accommodate easily.
Concluding the use case, I would say that a use case incorporates all behavior such as mainline behavior, variations, exceptions, errors and cancellation of request all behaviors that are relevant to a function in the system. Gathering all kind of behavior ensures that the use case have considered all the consequences while interaction.
Use Case Diagram
A system has a set of use cases where every use case presents a piece of systems functionality and a set of actors represents the set of objects to which system serves. A set of use cases presents the entire functionality of the system.
Use case diagram involves the graphical notation of a system using use cases in the system and actor interacting with the system. A system is represented by a rectangle. Inside the rectangle use cases are denoted by the ellipse. The actors in the use case diagram are represented by the ‘stick man’ and the relation between actors and use cases is represented by the solid line.
The figure below shows the use case diagram for a vending machine.
- Use case model describes the interaction of the users and the system.
- Use case model describes what functionality does a system provides to its users.
- Use case model has two important elements actors and use cases.
- Actors are the one who directly interacts with the system
- An actor is a set of objects that act in a particular way with the system.
- Every actor has a defined purpose while interacting with the system.
- An actor can be a person, device or another system.
- A use case is a piece of functionality that a system offers to its users.
- Set of use cases defines the entire functionality of the system.
- Use cases also define the error conditions that may occur while interacting with the system.
- Use case diagram incorporates both actor and use cases and also the relationship between them in the graphical representation.
So, this is all about the use case model and how it is useful for the developer to develop a system. We have also discussed the important elements of the use case model.