SENG 365 — Software Engineering
2026-10-21
By the end of this module, you should be able to:
Before class: Read Chapter 8, Sections 8.1–8.4.
A number appears simultaneously as digits, words, and a slider position. The user may change it from any view.
Which object should know about all the others?
If every view updates every other view, how many dependencies appear as views are added?
MVC is a responsibility decomposition. Observer is one way to keep views synchronized without pairwise dependencies.
Produce a diagram for Lucky Number containing:
Show both a push and pull option for transferring the new value.
Compare:
Notify observers when __________, but not when __________.
Before class: Read Chapter 8, Sections 8.5–8.7.
Which responsibilities belong in the handler? Which should be delegated?
For Lucky Number, sketch:
These are related but not identical. A framework constructs and calls parts of the application according to its lifecycle.
Produce:
Mark framework callbacks: these are places where “something else” controls when your code runs.
A handler may reasonably:
It should not quietly become the only home for validation, persistence, and business rules.
Application code fills framework-defined extension points:
Dependency injection is related but distinct: it answers how collaborators are supplied, not primarily who drives execution.
This event handler should delegate __________ because __________.
Before class: Read Chapter 8, Section 8.8.
An epidemiological tree records each person as a child of the person who infected them.
New operations arrive: count infections, find a person, export, redact, and compute depth. Should every operation become a method on every node type?
Retain the course example:
Where can traversal and each operation live?
Sketch and compare:
accept(Visitor) with a visit operation per element type.Evaluate the cost of:
Visitor supports an open-ended set of operations without continually changing the element interfaces.
It also:
Keep Visitor at recognition level: choose it for the force, not the name.
The existing Solitaire motivation is the same tradeoff: print, log, search, or remove across a recursive CardSource graph without bloating its interface.
Would a direct method, stream, or external iterator be simpler for the number of operations actually expected?
Visitor is overkill here if __________.

Course home · Neil Ernst ©️