SENG 365 — Software Engineering
2026-10-01
By the end of this module, you should be able to:
Before class: Read Chapter 4, Sections 4.1–4.3.
A vending machine has balance = 200 and selection = null.
Is its state “200 and null,” “has credit,” “awaiting selection,” or something else? What decision would your answer help make?
Concrete fields record values. Abstract states explain what operations are meaningful.
What combinations of fields are possible but nonsensical?
Produce a state diagram containing:
Keep a separate list of concrete fields that may implement each abstract state.
Revise the diagram for one of the following changes:
Which “state” was really an implementation detail?
Name states with nouns or stable conditions; name transitions with events.
Distinguish the state of the real world from the software’s record of it.
null, temporary fields, and convenience flags often expand the state space.The implementation must make __________ unrepresentable because __________.
Before class: Read Chapter 4, Sections 4.4–4.8.
Should a == b be true? Should a.equals(b) be true? Should both objects be allowed to exist?
Answer all three before choosing an implementation.
Why might this test pass alone and fail after another test?
Compare:
GameModel;GameModel; andFor each, record:
An immutable value need not be unique. A unique object need not be immutable.
equals() and hashCode().Do not turn “we only need one today” into an unexamined global dependency.
Absence is part of the state model:
Use Optional or a Null Object when absence is meaningful and the resulting interface is clearer. Do not use null merely because it is convenient.
Uniqueness is a domain rule when __________.
It is merely convenient when __________.

Course home · Neil Ernst ©️