When To Use <<include>> Vs. <<extend>> (4.4) - Object-Oriented Analysis and Design - Core UML Diagrams
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

When to Use <<include>> vs. <<extend>>

When to Use <<include>> vs. <<extend>>

Practice

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

<<include>> Relationship

πŸ”’ Unlock Audio Lesson

Sign up and enroll to listen to this audio lesson

0:00
--:--
Teacher
Teacher Instructor

Let's explore the <<include>> relationship. Can anyone tell me what it represents in Use Case Modeling?

Student 1
Student 1

Is it about including another use case in the description?

Teacher
Teacher Instructor

Exactly! The <<include>> relationship allows one use case to incorporate another's behavior. It's mandatory and often used to avoid redundancy in common functionalities across multiple use cases.

Student 2
Student 2

Could you give an example?

Teacher
Teacher Instructor

Certainly! For instance, both 'Place Order' and 'Manage Inventory' might require a user to 'Log In.' Instead of repeating the 'Log In' steps in each use case, we can simply say that they include 'Log In.' This is efficient!

Student 3
Student 3

So, it’s like a shared subroutine?

Teacher
Teacher Instructor

Exactly! Well put. Remember, when you use <<include>>, the included use case is always executed as part of the main flow of the base use case.

<<extend>> Relationship

πŸ”’ Unlock Audio Lesson

Sign up and enroll to listen to this audio lesson

0:00
--:--
Teacher
Teacher Instructor

Now, let’s discuss the <<extend>> relationship. Who can summarize what this represents?

Student 4
Student 4

Is it about optional functionalities?

Teacher
Teacher Instructor

Correct! The <<extend>> relationship allows an optional or conditional behavior to be executed only under certain conditions within a base use case.

Student 1
Student 1

Can you illustrate that with an example?

Teacher
Teacher Instructor

Sure! Take 'Process Payment' as a base use case. If a system detects potential fraud during payment processing, then the use case 'Handle Fraud' could extend 'Process Payment.' This only happens if the specified conditions are met.

Student 2
Student 2

So the base use case can still stand alone?

Teacher
Teacher Instructor

Exactly! The base use case remains meaningful even without the optional extensions, ensuring that we keep system functionality intact.

Distinguishing <<include>> and <<extend>>

πŸ”’ Unlock Audio Lesson

Sign up and enroll to listen to this audio lesson

0:00
--:--
Teacher
Teacher Instructor

Let's discuss the differences between <<include>> and <<extend>>. Who can highlight the main differences?

Student 3
Student 3

Is <<include>> about mandatory behaviors and <<extend>> about optional ones?

Teacher
Teacher Instructor

Yes! You've got it. <<include>> is mandatory and is always part of the flow, while <<extend>> is conditional and only adds behavior sometimes.

Student 4
Student 4

How about the execution of the use cases?

Teacher
Teacher Instructor

Great question! In <<include>>, the included use case must be executed for the base use case to work. In <<extend>>, the base use case can function independently, and the extension happens at specific extension points.

Student 1
Student 1

So we use <<include>> for shared routines and <<extend>> for specific cases?

Teacher
Teacher Instructor

Absolutely! That distinction is crucial for designing clear models. Always remember this while drafting your UML diagrams.

Best Practices

πŸ”’ Unlock Audio Lesson

Sign up and enroll to listen to this audio lesson

0:00
--:--
Teacher
Teacher Instructor

Now that we understand the differences, let's talk about best practices for using <<include>> and <<extend>>. What should we keep in mind?

Student 2
Student 2

Don’t overuse either relationship?

Teacher
Teacher Instructor

Exactly! Over-factoring can lead to confusion. Use these relationships to improve clarity and manage complexity, not to complicate things further.

Student 3
Student 3

What about defining extension points?

Teacher
Teacher Instructor

Good point! Clearly defining extension points in the base use cases is essential for using <<extend>> effectively. It indicates where the optional behaviors can occur.

Student 4
Student 4

Should we balance diagrams with specifications too?

Teacher
Teacher Instructor

Absolutely. Ensure that the diagrams and specifications complement each other to provide a full understanding of the model.

Introduction & Overview

Read summaries of the section's main ideas at different levels of detail.

Quick Overview

This section distinguishes between the <> and <> relationships in Use Case Modeling, focusing on their purposes and appropriate usage.

Standard

The section outlines when to apply the <> and <> relationships in Use Case Modeling, emphasizing the importance of using these relationships to manage complexity and improve reusability within Use Cases. Each relationship has specific use cases, enhancing clarity and function in UML diagrams.

Detailed

In Use Case Modeling, understanding when to use the <> and <> relationships is crucial for managing the complexity of functional requirements in a system

<> Relationship:
- Represents a mandatory inclusion of one use case's behavior within another. It emphasizes reusability by allowing common functionalities to be included across multiple use cases without redundant descriptions. The base use case always executes the included use case as part of its main flow.
- Example: In a shopping system, both 'Place Order' and 'Manage Inventory' may require 'Log In' as a prerequisite. Thus, 'Log In' can be included in both, avoiding duplication.

<> Relationship:
- Represents an optional or conditional extension of a base use case's behavior, activated only under specific conditions. This allows the base use case to function independently while providing additional functionalities when required.
- Example: In the 'Process Payment' use case, a behavior for 'Handle Fraud' can extend it if certain conditions (e.g., fraud detection) are met. Here, the base use case remains complete and meaningful on its own without the extension.

Key Takeaways:
- Use the <> relationship for mandatory shared behaviors, and use the <> relationship for optional behaviors that add flexibility without altering the core functionality of the base use case. By applying these relationships appropriately, developers can greatly improve the clarity and efficiency of their models.

Key Concepts

  • <>: Used for mandatory behaviors shared across use cases.

  • <>: Used for optional behaviors that occur under specific conditions.

  • Base Use Case: The primary use case that includes or is extended by other use cases.

  • Included Use Case: A subroutine that is compulsorily invoked by a base use case.

  • Extending Use Case: An optional behavior added to the base use case.

Examples & Applications

In an online shopping system, 'Place Order' and 'Manage Inventory' both require 'Log In', thus can use <> to avoid redundancy.

In a payment processing system, 'Process Payment' may extend with 'Handle Fraud' if certain fraud detection criteria are met.

Memory Aids

Interactive tools to help you remember key concepts

🎡

Rhymes

To avoid repeat in every way, <> comes to save the day.

πŸ“–

Stories

Imagine a shopping mall where a store requires customers to show ID before shoppingβ€”this is like an <>. However, if customers can receive discounts based on special offers at checkout, that’s like an <>!

🧠

Memory Tools

<>nclude for mandatory steps, <>xtend for what’s optional, so keep your flow perceptual!

🎯

Acronyms

I.E. for Include and Extend

Include is Essential

Extend is Optional!

Flash Cards

Glossary

<<include>>

A relationship in Use Case Modeling that represents a mandatory inclusion of one use case's behavior within another.

<<extend>>

A relationship in Use Case Modeling that represents an optional or conditional extension of a base use case's behavior.

Base Use Case

The main use case that either incorporates or is augmented by another use case.

Included Use Case

A use case whose behavior is included in the main flow of another use case.

Extending Use Case

A use case that provides optional behavior to a base use case under certain conditions.

Reusability

The property of a feature or component that allows it to be utilized in different contexts.

Reference links

Supplementary resources to enhance your learning experience.