Modeling How Systems Behave Under Different Conditions

UPI Study › Courses › Software Engineering › Free lessons › Lesson 7.3 Free with a free account

Modeling How Systems Behave Under Different Conditions

Software Engineering · Chapter 7: Behavioral Models and Requirements AnalysisSection 7.3 · lesson 49 of 1036 min · free with a free account

← Defining System Boundaries with Context DiagramsNext lesson: Breaking Down Requirements: Classes, Functions, and Behaviors →

Earn 3 college credits for Software EngineeringRecommended for credit by NCCRS · Computer Science 301 · self-paced · one payment, lifetime access

In this lesson

States, events, transitions - and why the same event can mean different things.

  • Define a state, and why responses depend on it
  • Distinguish an event from a transition
  • Read a state diagram, with its initial marker and transitions
  • Explain why a missing transition is meaningful

Transcript

Everything said in the video, section by section (887 words). Read along, or search it.

Behavioral Models and Requirements Analysis

Modeling How Systems Behave Under Different Conditions

Why does pressing the same button on a media player sometimes start playback, and sometimes do nothing at all? Because systems do not respond to events in a vacuum. This section covers state diagrams. How they model a system's response to events over time, and why what they leave out matters too.

Beyond Data

Same Button, Different Result

Data modeling answers what a system's information looks like. An order, its attributes, and its relationships. But it says nothing about what actually happens to that order over time. The very same event can produce completely different results, depending on what has already happened. Behavioral modeling, through state diagrams, is how that condition-dependent behavior gets captured and checked, before it is built. It models one system, or one object, responding to events. The step-by-step interaction between separate objects is a separate topic.

States

A Distinct Condition

A state is a distinct condition a system, or a single object in it, can be in at a given moment. While it is in that state, it behaves in a particular, consistent way. A media player is stopped, playing, or paused. An order is placed, shipped, delivered, or canceled. And while a system sits in one state, the same outside event can produce a different result than it would in another state. That is the core insight. Behavior depends on the event, combined with the state the system was already in.

Events and Transitions

What Happens, and What It Triggers

An event is something that happens that a system can respond to. It might be a user pressing play, a signal from another system, a timer expiring, or an operation completing. A transition is the move from one state to another that an event can trigger. But not every event triggers a transition from every state. An event that means something in one state may be entirely undefined, or simply ignored, in another.

Figure 7.3A

A Media Player's States

Here is a media player modeled as a state diagram. The filled dot marks the initial state. Before anything happens, the player is stopped. Pressing play moves it from stopped to playing. From playing, pause moves it to paused, and stop returns it to stopped. From paused, play moves it back to playing, and stop returns it to stopped. And notice what is missing. There is no pause transition from stopped. Pausing a stopped player simply means nothing.

Reading Figure 7.3A

"Play" Appears Twice

Look at where play appears. It shows up twice, on two different transitions. From stopped, play starts playback from the beginning. From paused, play resumes playback exactly where it left off. The event is identical. The outcome depends entirely on the state it was triggered from.

Figure 7.3B

An Order's Lifecycle

Here is a second example, the order entity from data modeling, now given a lifecycle. An order starts out placed. From placed, ship moves it to shipped, and cancel moves it to canceled. From shipped, deliver moves it to delivered, and cancel still moves it to canceled. But from delivered, there is no cancel transition at all. An order can be canceled while placed or shipped, but deliberately not once it has been delivered.

What's Left Out

A Missing Transition Is Information

A state diagram is just as informative for what it does not show. If no transition connects a given state to a given event, that combination is either meaningless in that state, or it has been left undefined. Careful reading of the diagram is exactly how that gap gets caught, before it becomes a real defect. And notice that the data model for an order said nothing about any of this. The two models are complementary. One describes the shape of the information. The other describes its behavior over time.

Table 7.3

State Diagram Notation

Here is the notation at a glance. A state is a distinct condition with its own consistent behavior, drawn as a rounded box with its name. An event is something the system can respond to. It appears as the label on a transition arrow. A transition is the move between states triggered by an event, drawn as a labeled arrow. And the initial state marker is a filled circle, with an arrow into the starting state.

Think About It

A Traffic Light

Here is a question to think about. Take a traffic light, with three states. Green, yellow, and red. Now take one event. A pedestrian presses the crossing button. While the light is green, that press can start the change toward yellow. While the light is red, pedestrians already have their turn, so the press changes nothing. Same event, different meaning, depending on the state.

Key Terms

The Vocabulary of This Section

Let's lock in the key terms. A state is a distinct condition a system or object can be in, during which it behaves consistently. An event is something that happens that a system can respond to. A transition is the move from one state to another, triggered by an event. A state diagram is a model showing a system's states, and the transitions between them. And the initial state is the state before any event has occurred, marked with a filled circle.

Key Takeaways

What to Carry Forward

To pull this together. The same event can produce different results, depending on the state it occurs in. An event is something that happens. A transition is the state change an event can trigger. State diagrams use a filled dot for the initial state, rounded boxes for states, and labeled arrows for transitions. A missing transition is meaningful. It shows a combination that is undefined, or deliberately not allowed. And behavior models and data models complement each other.

About Software Engineering at UPI Study

Software Engineering (Computer Science 301) is a self-paced online course of 103 video lessons in 15 chapters, from process models and agile to requirements, design, user interfaces, reliability, security and project management. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Software Engineering vs Systems Analysis

Why take it here

Why students take Software Engineering with UPI Study

How professional software gets builtSoftware Engineering covers how teams turn requirements into working, maintainable software: process models, agile, requirements, design, testing, reliability and project management. It is a core course in computer science and software degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Software Engineering carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Modeling How Systems Behave Under Different Conditions

What is a state in a UML state diagram?
A state is a distinct condition that a system, or a single object within it, can be in at a given moment, during which it behaves in a consistent way. A media player can be stopped, playing, or paused, and an order can be placed, shipped, delivered, or canceled. The key idea is that the same outside event can produce a different result depending on which state the system is already in.
What is the difference between an event and a transition in a state diagram?
An event is something that happens that the system can respond to, while a transition is the move from one state to another that an event can trigger. Events include a user pressing a button, a signal from another system, a timer expiring, or an operation completing. In the diagram, the event appears as the label on a transition arrow. Not every event triggers a transition from every state.
How do you read a state diagram for a media player?
Start at the filled circle, the initial state marker, which points to the starting state, here stopped. Each rounded box is a state and each labeled arrow is a transition. Play moves stopped to playing, pause moves playing to paused, and stop returns either one to stopped. Play appears twice: from stopped it starts from the beginning, while from paused it resumes where playback left off.
What does a missing transition mean in a state diagram?
A missing transition means that event, in that state, is either meaningless or has been left undefined, so it is real information rather than an oversight to ignore. A stopped media player has no pause transition because pausing it means nothing. An order has no cancel transition from delivered, so it is deliberately not allowed. Reading for these gaps catches undefined behavior before it becomes a defect.

About the Software Engineering course

How many college credits is Software Engineering?
Software Engineering (Computer Science 301) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Software Engineering cost and what is included?
$250, paid once, with lifetime access: all 103 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Software Engineering take?
It is self-paced with no deadlines. The 103 lessons total about 11 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Software Engineering.

103 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Software Engineering
3 credits · NCCRS
Enroll →