Unit-4
Basic Behavioral Modeling:
Basic Behavioral Modeling in Object-Oriented Analysis and Design (OOAD) focuses on
understanding how a system behaves over time — how its objects interact, respond to events,
and change states.
Here’s a concise breakdown:
What is Behavioral Modeling?
It’s about describing the dynamic aspects of a system:
How objects interact.
How the system responds to events.
The sequence of operations.
The state changes of objects.
Key Elements of Basic Behavioral Modeling
1. Use Case Diagrams
Purpose: Capture the functional requirements of the system.
Elements:
o Actors (users or other systems)
o Use Cases (system functionalities)
o Relationships (e.g., include, extend)
Example: In a library system:
Actor: Librarian
Use Case: Issue Book
2. Interaction Diagrams
Used to model how objects collaborate to realize a behavior.
a) Sequence Diagrams
Shows time-ordered interaction between objects.
Focuses on message passing between objects.
Example:
User → ATM : insertCard()
ATM → BankServer : validateCard()
BankServer → ATM : validationResult
ATM → User : requestPIN()
b) Communication (Collaboration) Diagrams
Emphasize the structural organization of objects.
Similar to sequence diagrams, but order of messages is numbered.
3. State Diagrams (State Machine Diagrams)
Show the life cycle of an object.
Used when an object’s behavior depends on its state.
Elements:
States (e.g., Idle, Processing)
Events (e.g., ButtonClicked)
Transitions
Example: For a Traffic Light:
States: Red → Green → Yellow
Events: Timer expires
4. Activity Diagrams
Represent the flow of control or data (like flowcharts).
Good for modeling workflows or business processes.
Elements:
Actions
Decision points
Forks/Joins
Start/End nodes
Example: Online order process:
Start → Browse Items → Add to Cart → Checkout → [Payment Successful?] → Ship
Item → End
Summary Table
Diagram Type Purpose Focus
Use Case Diagram Define system functionality Actors + Use Cases
Diagram Type Purpose Focus
Sequence Diagram Time-ordered interactions Message flow
Communication Diagram Object collaboration Structural relationships
State Diagram Object behavior based on state States + transitions
Activity Diagram Workflow representation Control & data flow
Interactions:
What are Interactions in OOAD?
Interactions refer to the communication or message exchange between objects to accomplish a
particular task or behavior in a system. They show how objects collaborate to perform use cases
or functions.
Types of Interactions in OOAD
1. Message Passing:
o Objects send messages to each other to request actions or provide information.
o A message can be a method call or a signal.
2. Object Collaboration:
o Multiple objects work together, exchanging messages, to fulfill a responsibility.
Interaction Modeling in OOAD
Interactions are typically modeled using UML diagrams, mainly:
1. Sequence Diagrams
Show objects involved in an interaction arranged in a timeline order.
Focus on time sequence of messages.
Useful for understanding the flow of control between objects.
Example elements:
Lifelines (representing objects)
Messages (arrows between lifelines)
Activation bars (indicating execution time)
2. Communication Diagrams
Show objects and their relationships, focusing on structural organization rather than
sequence.
Emphasize message flow and object links.
3. Interaction Overview Diagrams
Combine sequence and activity diagrams.
Show control flow between interactions.
Why are Interactions Important in OOAD?
They help understand system behavior.
Identify responsibilities of objects.
Clarify collaborations necessary for use cases.
Serve as a blueprint for implementation.
Summary Table
Aspect Description
Definition Communication between objects to fulfill tasks.
Key Mechanism Message passing (method calls, signals).
UML Diagrams Sequence diagrams, communication diagrams.
Purpose Model dynamic behavior and collaborations.
Importance Defines interaction protocols and object responsibilities.
Interaction Diagrams:
What are Interaction Diagrams?
Interaction diagrams are UML diagrams that depict how objects communicate with each other
over time to carry out a function or a use case. They focus on dynamic behavior and message
flow between objects.
Use Cases of Interaction Diagrams in OOAD
Interaction diagrams are mainly used to:
1. Model Use Case Realization
Show how a use case is executed in terms of interactions between objects.
Help map use case scenarios to design by illustrating message flow.
Clarify object roles and responsibilities during the execution of a use case.
2. Visualize Object Collaborations
Demonstrate which objects are involved in a particular task.
Highlight message sequences or communication paths between objects.
Help understand how objects collaborate to perform functionality.
3. Analyze Dynamic Behavior
Capture the order and timing of messages.
Show control flow and decision points during interaction.
Useful for validating complex behaviors and ensuring correct interaction logic.
4. Identify Design Constraints and Dependencies
Reveal dependencies between objects and methods.
Help detect potential bottlenecks or tight coupling.
Support refactoring or optimization by visualizing object interactions.
5. Support System Testing and Validation
Interaction diagrams can be translated into test cases.
Assist testers in understanding interaction sequences for functional testing.
6. Document System Design
Serve as part of design documentation.
Provide clear communication between stakeholders (developers, analysts, testers).
Common Interaction Diagrams Used for Use Cases
Diagram Type Purpose in Use Case Modeling
Shows object interactions arranged in chronological order; ideal for
Sequence Diagram
detailed use case scenarios.
Communication Highlights object relationships and message flows; good for
Diagram emphasizing structural aspects of use case interactions.
Interaction Overview Combines sequences to model complex use case flows or multiple
Diagram scenarios.
Example: Use Case — "User Login"
Objects involved: User, Login Controller, Authentication Service, User Database.
Sequence Diagram: Shows the login request, credential verification, response messages.
Helps visualize the flow from user input to system authentication.
Use Case Diagrams
In Object-Oriented Analysis and Design (OOAD), Use Case Diagrams are a crucial part of
modeling a system's functional requirements. They are used to capture interactions between
users (actors) and the system to achieve a goal. These diagrams help in understanding what the
system should do from the user’s perspective.
What is a Use Case Diagram?
A Use Case Diagram is a type of behavioral UML diagram that visually represents the
different ways users (actors) interact with a system. It shows:
Actors: External entities (users, systems) interacting with the system.
Use Cases: The specific goals or functions the system provides.
Relationships: How actors and use cases are connected (associations, include, extend,
generalization).
Key Elements of a Use Case Diagram
Element Description
An entity (human or system) that interacts with the system (e.g., "Customer",
Actor
"Admin").
Use Case A function or service provided by the system (e.g., "Login", "Place Order").
Defines the scope of the system. Use cases lie within the boundary, actors
System Boundary
outside.
Association A line showing interaction between actor and use case.
Include Reusable functionality. One use case includes another.
Extend Optional or conditional behavior that extends a base use case.
Actors or use cases inherit behavior from another (e.g., "Admin" is a
Generalization
specialized "User").
Example: Use Case Diagram for an Online Shopping System
Actors:
Customer
Admin
Payment Gateway
Use Cases:
Register
Login
Browse Products
Add to Cart
Checkout
Make Payment
Manage Products (Admin only)
Relationships:
Customer → Login
Customer → Browse Products
Customer → Checkout → (includes) Make Payment
Admin → Manage Products
(I can draw this for you if you'd like a visual example.)
Why Use Use Case Diagrams in OOAD?
1. Clarify system behavior: Shows what the system must do.
2. Aid communication: Easy for stakeholders to understand.
3. Basis for design and testing: Drives system design and test case generation.
4. Requirement traceability: Links user needs to functionalities.
Best Practices
Focus on user goals, not system functions.
Keep it simple and high-level.
Use include for common use cases (e.g., "Login" reused by many actors).
Use extend for optional flows (e.g., "Apply Discount").
Let me know if you'd like:
A drawn example diagram
A breakdown of how to create one from requirements
A tool recommendation for drawing (like Lucidchart, [Link], etc.)
Activity Diagrams:
In Object-Oriented Analysis and Design (OOAD), Activity Diagrams are a type of
behavioral UML (Unified Modeling Language) diagram used to model the flow of control or
data within a system. They are especially useful for representing business processes,
workflows, and the logic of operations.
What is an Activity Diagram?
An Activity Diagram visually represents the sequence of activities (or tasks) in a process or
operation. It shows how control flows from one activity to another and can include conditions,
decisions, concurrency (parallel processes), and synchronization.
Purpose in OOAD
In OOAD, activity diagrams help in:
Understanding system behavior before coding.
Modeling the workflow of use cases.
Analyzing the logic of complex operations or business rules.
Showing interactions between system components.
Identifying parallel processes and decision points.
Key Elements of an Activity Diagram
Element Symbol Description
▭ (Rounded rectangle)
Start (Initial Node) ● Entry point of the activity.
Activity/Action A task or function being performed.
Decision Node ◆ (Diamond) Branching based on conditions.
Merge Node ◆ (Diamond) Merges multiple flows into one.
Fork Node — — (Thick horizontal/vertical bar)
Join Node — —
End (Final Node) ◉ (Solid circle with border) End of the activity flow.
Transition (Arrow) → Shows flow from one node to another.
Example Use Case: Online Order Process
A simple activity diagram for placing an online order might include:
1. Start
2. Browse Products
3. Add to Cart
4. Checkout
o If not logged in → Login/Register
5. Enter Shipping Info
6. Enter Payment Info
7. Confirm Order
8. End
This sequence shows conditional branches (e.g., login requirement), sequential actions, and
potentially parallel tasks (like validating payment and sending order confirmation).
Benefits of Using Activity Diagrams
Clarifies workflows for developers and stakeholders.
Detects logic errors early in design.
Helps with documentation and communication.
Guides implementation and testing phases.
Tools to Create Activity Diagrams
You can create activity diagrams using UML tools such as:
Lucidchart
[Link] ([Link])
StarUML
Visual Paradigm
Enterprise Architect
Example of use case Diagrams:
Example of Use Case: ATM Transaction
Example of Sequence Diagrams:
Example 1
Example 2
Example of Collaboration Diagrams:
Example of Activity Diagrams:
Example of Collaboration Overview Diagrams:
Example of Interaction Diagrams: