When to Use <<include>> vs. <<extend>> - 4.4 | Object-Oriented Analysis and Design - Core UML Diagrams | Software Engineering Micro Specialization
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Academics
Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Professional Courses
Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβ€”perfect for learners of all ages.

games

4.4 - 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

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

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

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

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

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

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

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

Student 4
Student 4

Is it about optional functionalities?

Teacher
Teacher

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

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

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

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

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

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

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

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

Best Practices

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

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

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

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

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

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

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.

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

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 & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • 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

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎡 Rhymes Time

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

πŸ“– Fascinating 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 <>!

🧠 Other Memory Gems

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

🎯 Super Acronyms

I.E. for Include and Extend

  • Include is Essential
  • Extend is Optional!

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: <<include>>

    Definition:

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

  • Term: <<extend>>

    Definition:

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

  • Term: Base Use Case

    Definition:

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

  • Term: Included Use Case

    Definition:

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

  • Term: Extending Use Case

    Definition:

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

  • Term: Reusability

    Definition:

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