2079 11

CSC375 ยท 2079 ยท 5 marks

What is behavioral model? Explain with an example.

What is behavioral model? Explain with an example. [5]

Software EngineeringChapter 5: System ModelingBehavioral Models

Quick answer

A behavioral model is a type of system model that describes the dynamic behavior of a system as it executes. It shows what happens or what should happen when a system responds to a stimulus from its environment. Behavioral model is one of the four main types of system models used to represent a system from different perspectives (along with contextual, interaction, and structural models).

Behavioral Model

Definition

Behavioral models are primarily used during requirement engineering to help system analysts validate system functionality and communicate clearly with customers about how the system will behave at runtime.


Types of Stimuli in Behavioral Models

Behavioral models are driven by two main types of stimuli:

  1. Data-driven stimuli -- a sequence of data arrives and the system processes it step by step.
  2. Event-driven stimuli -- the system responds to a specific event (which may or may not carry data).

Common Notation: State Diagram (State Machine Model)

A widely used behavioral model is the State Diagram (or State Machine Diagram), which shows:

  • States -- conditions or situations during the life of a system
  • Transitions -- movement from one state to another triggered by an event
  • Events/Actions -- what causes the transition or what happens during it

Example: Microwave Oven Behavioral Model

Consider a simple microwave oven system. Its behavior can be modeled as follows:

[Idle] ---(Door Opened)---> [Door Open]
[Door Open] ---(Door Closed)---> [Idle]
[Idle] ---(Set Time & Start)---> [Operating]
[Operating] ---(Timer Expired)---> [Operation Complete]
[Operating] ---(Door Opened)---> [Interrupted]
[Interrupted] ---(Door Closed)---> [Idle]
[Operation Complete] ---(Cancel/Reset)---> [Idle]

Explanation of States:

StateDescription
IdleMicrowave is waiting for user input
Door OpenDoor has been opened; cooking cannot start
OperatingMicrowave is actively cooking
InterruptedCooking was stopped because door was opened
Operation CompleteTimer has expired; cooking is done

How it works:

  • When the microwave is Idle and the user sets a time and presses Start, it moves to Operating.
  • If the door is opened during operation, it moves to Interrupted state for safety.
  • Once the timer expires, it moves to Operation Complete and signals the user (e.g., beeps).
  • The system returns to Idle after reset or cancel.

Importance of Behavioral Model

  • It helps validate requirements by showing how the system reacts to different inputs and events.
  • It helps communicate the expected dynamic behavior to both developers and customers.
  • It is essential for real-time and safety-critical systems where correct response to events is crucial.

In summary, a behavioral model captures the dynamic, event-driven nature of a system and is a key tool in system modeling for requirement engineering and system design.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.