include and exclude relationship in use case diagram

Mastering Include/Exclude in Use Case Diagrams: A Comprehensive Guide

By Thomas Lee
AD

In the realm of software engineering, use case diagrams play a pivotal role in illustrating the necessities and interactions among actors, their intentions, and the system's responses. Critical to their construction and interpretation are the 'include' and 'extend' relationships. Here, we delve into the intricacies of these relationships, their representations, and their purpose in the broader context of system design and development.

First off, understanding these relationships necessitates a preliminary dive into the concept of use cases. Use cases, in essence, capture functional requirements by providing a narrative of how actors interact with a system to achieve a specific goal. Now, let's unravel the 'include' and 'extend' relationships that can enhance our understanding of these use cases.

Include Relationship

The 'include' relationship is an association Flavian within use cases that expresses a use case's decomposition into a sequence of smaller actions. It's a fundamental concept that aids in breaking down complex functions into manageable steps.

AD
Use Case Diagram | Learn UML | Omer Javed Articles
Use Case Diagram | Learn UML | Omer Javed Articles
How to create a use case diagram | moelgendy blog
How to create a use case diagram | moelgendy blog
Use Case Diagram Tutorial: What It Is and How to Create One | Creately
Use Case Diagram Tutorial: What It Is and How to Create One | Creately

The 'include' relationship operating within the use case diagram utilizes a dashed line adorned with an open circle or a unframed arrowhead at the start. This line connects a use case (main) to another (sub-use case or included). This visual indicator, inclusive of its sourcing text "«include»", revitalizes the following features:

Refines the Flow

By incorporating smaller, manageable steps, the main use case's complexity is predominantly reduced. Each 'include' can translate to a semi-autonomous method, enhancing module and code reusability, and spawning clarity into the sequence of control flow.

Use Case Diagram for Login and Registration | UML
Use Case Diagram for Login and Registration | UML
Download Use Case Diagram for Library Management System
Download Use Case Diagram for Library Management System
UML Use Case Diagram Tutorial with Examples
UML Use Case Diagram Tutorial with Examples

Consider an e-commerce application's 'Checkout' use case. The process can be broken down into smaller, manageable steps: 'Select Payment Method', 'Enter Card Details', and 'Confirm Order'. Each of these steps can be an 'include', facilitating improved flow and simplicity.

Enriches Use Case Diagrams

'Includes' further enriches use case diagrams by better illustrating the sequence of steps necessary to accomplish the primary use case's goal. Succinctly, it offers a more comprehensive, less abstract view of how a system works, expediting communication among developers and stakeholders.

AD

In the context of a banking system's 'Withdraw Cash' use case, adding 'Check Balance' as an include in the flow signifies the sequential nature of these steps, enhancing the overall comprehensibility of the use case diagram.

UML Use Case Diagram for Airline Reservation
UML Use Case Diagram for Airline Reservation
Student Attendance System | Creately
Student Attendance System | Creately
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages
Difference Between Entity and Relationship in DBMS - Pediaa.Com
Difference Between Entity and Relationship in DBMS - Pediaa.Com
Redirecting...
Redirecting...
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages

Extend Relationship

The 'extend' relationship, meanwhile, pertains to intervening steps that are not always part of the main use case but can be included under specific circumstances. As such, they offer a level of flexibility and adaptability within the system, typically represented by a dashed line with a hollow arrowhead, and marked by "«extend»".

'Extend' relationships are crucial as they introduce potential bifurcations or conditional branching within a use case, ensuring adaptability to unique or rapidly evolving system requirements.

AD

Promotes Flexibility

'Extend' relationships allow optional functionalities and workflows during use case execution. If a certain condition is met, the system can then opt to perform its specified action, strengthening the system's adaptability to its environment and users' circumstantial requirements.

Use Case Diagram for College Management System
Use Case Diagram for College Management System
Airline Reservation System - Usecase Diagram | Creately
Airline Reservation System - Usecase Diagram | Creately
Use Case Diagram Template
Use Case Diagram Template
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages
Verifying Use Cases, Data Flow Diagrams, Entity Relationship Diagrams, and State Diagrams via State Linkages
Use Case Diagram for Student Enrollment System
Use Case Diagram for Student Enrollment System
Use Case Diagram Tutorial: What It Is and How to Create One | Creately
Use Case Diagram Tutorial: What It Is and How to Create One | Creately
Shop System Use Case Diagram
Shop System Use Case Diagram
End-to-End UML: Use Case Diagram
End-to-End UML: Use Case Diagram
UML Class Diagram Relationships Explained with Examples | Creately
UML Class Diagram Relationships Explained with Examples | Creately
UML Use Case Diagram for Online Shopping
UML Use Case Diagram for Online Shopping
a diagram that shows the flow of different items in an organization, including two people and one person
a diagram that shows the flow of different items in an organization, including two people and one person
Simple Usecase Template | Creately
Simple Usecase Template | Creately
Use Case Diagram
Use Case Diagram
UML Use Case Diagram
UML Use Case Diagram

Within the scope of an ATM's 'Withdraw Cash' use case, the 'Check if Customer has Paid Debt', an extend relationship, allows for flexibility. If a user is delinquent on their loan, the system can outreach their lender for verification and potentially deny the transaction.

Encourages Code Reusability

The 'extend' relationship enables the creation of reusable code snippets. If a function, when invoked in certain conditions, can reuse a set of commands, it reduces innocuous redundancy in code. This also means that any updates or modifications to these parts of the system cascade directly into all the use cases that extend it.

AD

Take an e-commerce platform's 'Purchase' use case. If 'Apply Coupon', an extend, is activated upon meeting certain conditions (e.g., customer has a valid discount code), it promotes code reusability and prevents copy-pasting redundant coupon application logic into other use cases.

In conclusion, while understanding and accurately representing 'include' and 'extend' relationships in use case diagrams can seem daunting initially, these mechanisms offer indispensable assets in managing system complexity. By forming the backbone of use case decomposition and offering enhanced adaptability, they consistently improve the robustness, efficiency, and ease-of-use of developed systems. As such, harnessing their potential is invaluable for software developers and project stakeholders alike.

AD