Skip to main content
Object Oriented Design, Analysis and Programming

Object Oriented Design with UML Interaction Models

Published: 2026-08-19
Level: postgraduate
Audience: Postgraduate students in Object Oriented Design, Analysis and Programming

9.1 Design as a Creative Solution Activity and the Need for Principles

9.1.1 Moving into the Solution Domain

Hook: Analysis tells us what the library world contains — borrowers, catalogs, cards. Design asks: inside the machine, which software objects will actually do the work, what will each remember and do, and how will they talk to each other to issue that book?

Intuition — from floor plan to building: Think of analysis as a domain model — a floor plan that names rooms (Borrower, Book, Catalog) and how they relate, without saying how the plumbing runs. Design is the engineering blueprint that opens the black box: we decide where pipes and wires go, which software objects hold which state, and which valves (methods) each offers.

Mapping: domain objects → inspiration for software objects; associations → links that allow messages; real-world responsibilities → software methods. Where the analogy breaks: a real borrower is a person, but a software Borrower or UserAccount is an abstraction that may merge several real concepts or introduce purely conceptual helpers (for example a LoanPolicy or FineManager) that have no physical counter-part. We keep the names that help humans, but we are free to rename, split, or merge.

Formalize — what changes from analysis to design:

  • Domain model (analysis): names key domain objects and associations. No methods. Black-box view — we care about what exists.
  • Design model (design): white-box view. We define a collection of software objects — runtime entities that hold state and offer behaviour — whose collaboration fulfills the stated requirements.

For each software object we define:

  • State — its attributes, the values it remembers (for example UserAccount.fineBalance, BookCopy.status).
  • Behaviour — its methods, the operations it can perform and expose to others.
  • Collaborationmessages sent over links to get work done.

A class is the definition for a family of such objects. In the conceptual class diagram no methods were shown; in design, methods are the primary addition. The complete design is described as three compartments per class: class name | attributes | methods — ready to hand to a programmer or to a tool that generates skeleton code.

Crucially, software objects are inspired by domain objects but not identical to them. Iterative development expects revision: as we draw interaction diagrams and discover missing responsibilities, we revisit earlier decisions, rename, merge, or add conceptual objects.

Scope & assumptions:

  • When this applies: every time we move from requirements to an executable object model, whether we sketch on walls or in a CASE tool.
  • Assumption: requirements and domain model are available as inspiration; we are working inside the system boundary, not modelling the external world.
  • What breaks if violated: if we copy domain objects literally without asking "who should do what?", we get an anaemic or overloaded design — either objects with only data and no behaviour, or one coordinator doing everything. Both raise coupling and lower cohesion (see 9.7.4). If we never revisit decisions, early modelling errors freeze into code.

Visual intuition — imagine a timeline from top to bottom: analysis shows a single black box labelled LibrarySystem; design explodes that box into half a dozen smaller boxes (Borrower, UserAccount, Catalog, BookCopy, Loan) with arrows between them. The density of arrows is the design: sparse, well-labelled arrows indicate clear responsibilities; a starburst of arrows from one central box hints at low cohesion.

Pitfalls:

  • "Domain = software": treating every real-world noun as a 1-to-1 class. Fix: ask whether a concept needs software state or behaviour; introduce conceptual objects when a real-world object would be overloaded.
  • "Classes first, interactions later": sketching only a class diagram and postponing message flows. In practice the hard, interesting decisions are discovered while drawing interaction diagrams — the logic and method bodies — not the static structure.
  • Forgetting iterative revision: assuming the first object set is final. Good teams plan to redraw after coding experiments reveal new needs.

Real-world & domain connection: In industry, the transition from analysis to design is the handover gate between business analysts and developers. An e-commerce checkout, a hospital patient-record, or a library issuance flow all use the same move: start from domain nouns verified with users, then craft software objects that are named for recognition (low representational gap, see 9.3.3) but shaped for implementation — with complete attribute and method signatures so that a code generator can produce class skeletons in Java, C#, or Python.

Recap — bridge: Analysis names the world; design builds the software community that will animate it. With that framing, the next question is how to avoid inventing every collaboration from scratch — which leads to reusable patterns and principles.

9.1.2 Representational Challenge and Why Rules Are Needed

Core idea: A design is not a pile of classes; it is a flowing exchange among objects over time. Visualizing that exchange is the hardest part, because time and collaboration are dynamic, not static.

Two needs arise:

  1. A notation to show interaction. Unified Modeling Language (UML) provides the standard visual language — sequence diagrams for time order, communication diagrams for structural organization, plus class diagrams and state charts for the static and lifecycle views (see 9.4).
  2. Principles to justify choices. Many arrangements can implement the same requirement. A good design is workable, optimal for the context, explainable, and rational. Principles — rules analogous to theorems and proofs — let us argue methodically that a choice will hold across situations before any code is written. Without them a novel design carries no guarantee; with them we can evaluate alternatives on coupling, cohesion, and responsibility assignment (GRASP) rather than on taste.

Think of city traffic: any set of roads can connect the same neighbourhoods, but only some layouts handle rush hour, allow future extension, and are easy to explain to a new driver. UML is the map; design principles are the traffic engineering rules.

Scope:

  • Principles are guidance for evaluation, not code templates to copy. They apply under assumptions such as a single thread of control, object identity, and message-passing via method calls. In concurrent or distributed settings additional concerns (synchronization, network partitions) modify how the same principles are applied.
  • Notation covers structure and time, not performance numbers or deployment — other UML views handle those.

Pitfalls:

  • Notation without reasoning: drawing neat sequence diagrams that merely document an arbitrary division of work. Every message assignment should answer "why this receiver?" using responsibility ideas (Information Expert, Creator, etc.).
  • Principle as law: applying high cohesion / low coupling or a pattern dogmatically without weighing the trade-off in the current iteration. All else equal, prefer lower coupling and higher cohesion, but measure against the actual use case.

Real-world: code-generation tools that turn diagrams into skeleton code depend on this completeness — named methods, typed parameters, and return types — and on the guarantee that the chosen pattern has worked elsewhere, so reviewers can trust the design before implementation.

Recap — bridge: We need both a language (UML) and a rationale (principles/patterns) to explore interactions efficiently and to pick the best alternative with confidence.

9.1.3 Student Questions and Answers

Q: Why reuse existing patterns instead of inventing a fresh design from scratch?

A: Saving time and lifting productivity matter, but the deepest reason is confidence/guarantee. A pattern pairs a recurring problem with a general solution proven in many earlier situations. Reusing it means reusing that evidence — we can point to prior successes and argue why the fit holds after customization. A completely new design lacks that track record. The professor compared this to theorems and proofs: they guarantee a mathematical result will hold; patterns give a comparable guarantee that the design arrangement will work before we code it. So we adapt what is known and invent only for truly new requirements.

9.1.4 Industry Applications

Real-world: Design documentation in industry is produced as UML interaction diagrams, class diagrams, and state charts. Tools that generate code from diagrams depend on a complete design with named methods, parameters, and return types. Review checklists ask whether each system operation identified in the use-case realization has a corresponding interaction diagram whose messages each map to a declared method, and whether the chosen responsibilities are justified by named principles rather than ad hoc assignment.

9.2 Reusable Solutions — Patterns, Productivity and Guarantee

9.2.1 What a Pattern Is

Hook: Why do experienced designers converge on the same object arrangements — a Sale creates its SalesLineItems, a Board knows its Squares — even when they have never met? Because they are reusing named patterns, not reinventing.

Intuition — recipes, not photocopies: A pattern is like a recipe for a dish, not a frozen ready-meal. It names a recurring problem (for example "who should create this object?") and a general solution (for example "let the container create the contained") that works in many kitchens. You customize ingredients and quantities to your context, but the structure — the steps and the rationale — is shared. Copy-paste code would be the frozen meal; a pattern is the adaptable template that captures collective experience about what arrangements tend to succeed.

Where the analogy breaks: a recipe tells you exact steps; a pattern also tells you forces and trade-offs — when to use it, when to prefer an alternative (for example preferring a Factory when creation is complex).

Formalize:

A pattern — a named pairing of a recurring problem and a general solution that works in many situations — is not copy-paste code; it is a template we customize to our specific context. Two major collections frame the design portion of this course:

  • Gang of Four (Gamma et al.) — 23 object-oriented patterns. A widely referenced catalogue covering creational, structural, and behavioural problems (for example Strategy, Adapter, Observer, Factory). Originally described in C++ but language-independent.
  • GRASP (Larman) — nine patterns/principles for responsibility assignment. GRASP (General Responsibility Assignment Software Patterns) teaches who should do what and how to use inheritance, composition, and aggregation wisely. The nine are: Creator, Controller, Information Expert, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection, Protected Variations. Five are treated in this lecture block; four follow in the next class. GRASP is best viewed as a learning aid that names basic, classic principles — expert designers recognise the ideas even without the names.

Both collections will be studied across the design portion, applied while sketching interaction diagrams and while coding.

Scope & assumptions:

  • Patterns assume an object-oriented language with identity, encapsulation, and message passing (method calls). In non-OO or highly constrained embedded settings the same forces apply but the mechanism changes.
  • A pattern is proven in context; blind application without checking forces (for example creating through an aggregator when you need a pluggable factory) trades one problem for another.

Visual: picture a wall with two columns — on the left, 23 GoF pattern cards; on the right, 9 GRASP cards. Arrows from example design problems (creation, knowing, coordinating) point to the card that resolves them. The takeaway is a shared vocabulary: a team can say "use Creator here" and everyone pictures the same delegation shape.

Pitfalls:

  • Pattern as recipe to follow literally: treating "Board creates Squares" as a rule for all creation, even when creation needs recycling or family-based choice — where a Factory is instead advised.
  • Collecting names without applying reasoning: listing all 23 GoF patterns but not using Low Coupling / Expert to decide why a particular assignment wins.

Real-world: In a retail platform team, "Sale creates SalesLineItem" and "Sale knows its total via collaborators" are taught as GRASP applications rather than as one-off decisions, so a new hire reading the diagram immediately understands the rationale and the next feature (for example adding getDiscountedTotal) naturally falls to the same Information Expert.

Recap — bridge: Patterns give us the named ideas; the real payoff is why we should reuse them.

9.2.2 Why Reuse Matters

Formalize — from vague to precise: The session asked "What is the advantage of reusing a solution?" Answers offered were "reduce redundancy," "save time," "improve productivity." The professor refined this: reducing redundancy alone is vague — duplicated code can be removed without improving the design. The precise benefits are:

  • Saves time and lifts productivity: less invention, less testing of already-solved logic.
  • Builds shared vocabulary: a team that knows Creator, Expert, or Publisher-Subscriber can communicate a design decision in a short sentence and review it quickly.
  • Supplies a guarantee: any reusable solution that has already worked elsewhere carries evidence. Reusing it means reusing that evidence. The design becomes explainable: we can point to a known pattern and say why it fits. This is the engineering and mathematical stance — we can claim in advance that the design will work because it rests on proven principles, just as a theorem rests on its proof.

The theorem-proof analogy: a theorem is trusted because a proof has been checked; a pattern is trusted because many prior applications have been checked. Neither removes the need to adapt carefully, but both shift confidence from "hope it works" to "we have reason to believe it will."

Reusability also shortens iteration (less redrawing), reduces representational effort (names already understood), and makes reviews tractable: a reviewer asks "did you apply Creator here?" rather than re-deriving the whole logic.

Comparison — new design from scratch vs. patterned reuse:

Dimension From scratch Pattern-based reuse
Time to first design Longer — every decision reasoned from first principles Shorter — start from proven template, customize
Confidence before coding Low — no prior evidence Higher — prior successes provide rationale
Team communication Needs lengthy walk-through Short — name carries meaning ("use Information Expert")
Maintenance risk Unknown coupling consequences More predictable — pattern trade-offs are documented

One-line "when to pick which": reuse a pattern whenever the forces match; invent only for truly new requirements where no pattern's forces apply.

Scope: Guarantee is not absolute correctness. It means justified confidence given stated assumptions. If assumptions fail (for example scale grows by 100×, threading changes), the same pattern may need supplementation (caching, Factory, concurrency control).

Pitfalls:

  • Treating "reduce redundancy" as the whole story: removing duplicate lines without fixing responsibility placement leaves a design that is still hard to maintain.
  • Over-confidence: assuming that naming a pattern makes the design automatically correct. The pattern must still be applied with its conditions — for Creator, the creator should contain, record, closely use, or have initializing data for the created object; if none holds, look elsewhere.

Real-world: At scale, teams reuse architectural patterns for transaction handling and inventory management (for example the Sale–SalesLineItem–ProductDescription collaboration) rather than designing each sales flow from scratch. In a design review, the author says "Creator and Expert here, Low Coupling evaluated against a Dog-owns-Square alternative" and the review moves in minutes instead of hours.

Recap — bridge: The compelling reason to reuse is not just less typing but a methodical, explainable, and therefore engineering basis for claiming the design will hold — which prepares us to look concretely at how objects collaborate.

9.2.3 Student Questions and Answers

Q: What does "reduce redundancy" mean as the benefit of reusable solutions? Several participants repeated that phrase.

A: Reducing redundancy alone is vague in this context. A more precise benefit is that reuse cuts duplicated effort and duplicated testing, but more importantly it saves time, lifts productivity, and supplies a guarantee because the pattern is already proven in practice. Theorems and proofs were offered as the analogy: they guarantee that a mathematical solution will hold; patterns give a similar guarantee that a design choice will hold after adaptation. In short, "reduce redundancy" is a surface description; "save time, improve productivity, provide justified confidence via a proven solution" is the sharper formulation the course will test.

9.2.4 Industry Applications

Real-world: At scale, teams reuse architectural patterns for transaction handling and inventory management rather than designing each flow from scratch, which shortens delivery and simplifies review. A pattern vocabulary lets architects conduct lightweight reviews: a checklist asks "is creation assigned per Creator?", "is knowing assigned per Expert?", "does coupling increase?" — questions that turn subjective debate into structured evaluation.

9.3 Objects, State, Behaviour, and Collaboration

9.3.1 State, Behaviour and Software Objects

Hook: How do we turn a real library card into something a program can reason about — that remembers a fine balance today, changes it tomorrow, and knows which operations make sense in each state?

Intuition — people as objects, with a break point: The professor offered the people analogy: just as people collaborate by exchanging requests and using each other's capabilities, software objects do the same through message passing. A person remembers information (state) and can perform tasks when asked (behaviour); an object remembers attribute values and offers methods. The mapping is explicit: person ↔ object, memory ↔ attributes, capability ↔ method, request ↔ message.

Where it breaks: people can improvise and interpret vague requests; objects only do what their interface explicitly promises — they act as a black box whose callers rely on the interface guarantee without inspecting internals. Vague requests fail loudly; so precision in method contracts matters.

Formalize:

  • An object — a runtime entity that holds state and offers behaviour — carries its own attribute values and the operations that manipulate them. For example a UserAccount with userID: String, loanCount: Integer, fineBalance: Money, and operations such as authenticate(), canBorrow().
  • A class is the definition that describes a family of such objects — the template for their attributes and method signatures.

During design we decide the state each software object will maintain and the set of methods it will expose. Attributes may grow compared to the conceptual model (adding dueDate, issuedDate, or status needed for implementation), and methods are now supplied in full. Responsibilities — the things an object is asked to do — are assigned as methods. An object moves through different states as attribute values change, and different operations become relevant in different states (for example a BookCopy that is available vs. issued vs. overdue exposes different allowed actions).

The black-box view: callers rely on the interface guarantee (pre/post-conditions) and never need to inspect internal data structures.

Scope & assumptions:

  • Applies when modelling with an OO language supporting encapsulation and message passing. If the language is procedural, the same responsibilities exist but are grouped as modules/functions rather than objects.
  • Assumes objects collaborate via direct messages, not via a hidden global coordinator. If a framework mediates, the link structure adapts but the responsibility questions remain.

Visual: picture a single object as a capsule with a private interior (attributes) and a row of buttons on the outside (methods). Arrows from other capsules press buttons; the interior changes but remains hidden. A state chart (see 9.4.2) then shows that capsule changing colour as it moves between states.

Pitfalls:

  • Anaemic objects: putting all behaviour in one coordinator and leaving domain objects as pure data holders. This collapses cohesion and raises coupling.
  • Exposing state directly: allowing external code to mutate attributes without going through methods. Use getters/setters as messages so invariants can be preserved.
  • Forgetting state-dependent behaviour: assuming every method is always applicable. Model which operations are valid in which state (loan cannot be returned before it is issued).

Real-world: In a banking ledger, an Account object in state overdrawn refuses a withdraw() message differently than in state active. The same pattern appears in the library Loan moving through requested → issued → overdue → returned. Designing state-aware methods prevents illegal transitions early, before code is written.

Recap — bridge: Once each object's state and behaviour are clear, the key design question becomes how they interact — the collaboration view.

9.3.2 Collaboration and Message Passing

Formalize: An object-oriented system is fundamentally an interactive system. Objects achieve a larger purpose by interacting, sending messages to one another. A message — the name of a service requested from another object together with any information needed to perform it and any result returned — is the means of collaboration. In implementation, "send a message" most often means "make a method call and optionally receive a return." No hidden coordinator is needed; objects call each other directly over declared links (instances of associations).

Responsibility-driven design is the discipline of assigning methods by asking "who should do what?" based on information ownership and existing duties.

CRC cards (Classes, Responsibilities, Collaborators) — a paper index-card technique by Beck and Cunningham — support brainstorming: for each class we list what it is responsible for and which collaborators it needs to complete that responsibility. Playing through scenarios with CRC cards helps identify missing objects and clarifies whether the current object set is sufficient before committing to diagrams.

Picture three people around a table each holding a CRC card: when the scenario "borrow a book" is played, the Borrower card says "I need authentication", pointing to UserAccount; the Catalog card says "I know copy availability." Moving a responsibility from one card to another makes coupling and overload immediately visible.

Scope: CRC is lightweight, intended for exploratory wall sketching. It precedes but does not replace UML interaction diagrams; the latter become the precise contract for method signatures.

Pitfalls:

  • Invisible collaboration: assuming objects collaborate without declaring a link/association that justifies a message. Every message should have a justifying structural relationship.
  • Missing collaborators: stopping at the initial domain nouns and not asking "who else is needed?" — often a Loan, FinePolicy, or Reservation conceptual object emerges here.

Real-world: Workshop teams in agile iterations spend a wall of CRC cards before opening a CASE tool. For example, a POS team plays "make new sale → enter item → end sale → make payment" with cards for Register, Sale, SalesLineItem, and ProductCatalog, discovering that Sale should create SalesLineItem (Creator) before any UML is drawn.

9.3.3 Low Representational Gap

Formalize: A representational gap is the distance between concepts in the real world and their counterparts in software. Object orientation aims for a low representational gap: keeping real-world names and ideas in the software so the model stays close to reality, which aids understanding and keeps the system aligned with what users recognise. Analysis, design, and programming all use objects, so the same conceptual tool runs through every phase. We take inspiration from reality, translate domain objects into software objects, and refine them so the gap narrows while acknowledging that software objects are still abstractions, not literal real-world things.

In Larman's terms (T1, Ch. 17), low representational gap connects the Domain Model to the Design Model: if the domain has Sale and SalesLineItem, the design can meaningfully have software classes with those names, but we remain free to add purely software inventions (for example ProductCatalog singleton, Payment factory) where they improve cohesion and coupling.

Analogy — map vs. territory: A low-gap model is a street map that uses the same street names as the real city. You can ask a librarian "where is the catalog?" and the developer points to Catalog. Where it breaks: a map is not the city — it omits plumbing and may add grid lines (conceptual objects) that exist only to make navigation easier.

Scope: Low gap is a guideline, not a rule. When domain concepts would cause duplication or excessive coupling, a Pure Fabrication (a conceptual object invented for design) with low gap violation is justified — for example a BorrowPolicy that centralises fine and loan-limit rules.

Pitfalls:

  • Literalism: forcing software to mirror every physical nuance (for example modelling the wooden library counter as a class) — adds noise without behaviour.
  • Jargon drift: renaming domain concepts into technical synonyms (BorrowerBorrowerEntityManager) that widen the gap and confuse stakeholders.

Real-world: Keeping Borrower, Loan, BookCopy, Catalog in both the domain and software models lets a library domain expert validate a sequence diagram without learning programming concepts, shortening feedback loops.

9.3.4 Worked Example — Borrowing a Book from a Library

Worked example — Borrow a book (central collaboration walk-through):

Use case & setup: A library member goes to the counter with a requested title. Participating concepts include Borrower (library member, user), LibraryManagementSystem (coordinator that applies rules), BookCatalog, BookCopy, UserAccount, LibraryCard, and LibraryStaff / Counter service. The exact object set is allowed to evolve — for example adding a Loan, FinePolicy, or Reservation object if checks become complex.

Rules the design must enforce (invariants to realize as messages):

  • Card verification and user authentication must succeed; borrower must be a valid member.
  • Loan-limit check: currentLoanCount + 1 ≤ maxAllowed (example limit maxAllowed = 5).
  • Fine check: if fineBalance > threshold (say threshold = 0), the member must clear/deposit fine before issuance.
  • Availability: Catalog must report at least one BookCopy with status = available for the title.

Plain-word message sequence (to be later drawn as sequence/communication diagrams):

  1. Borrower → LibraryManagementSystem : requestIssue(title)
  2. LibraryManagementSystem → UserAccount : verify(cardID)UserAccount returns authenticated: Boolean, loanCount: Integer, fineBalance: Money (e.g., loanCount = 4, fineBalance = 0, authenticated = true)
  3. LibraryManagementSystem → UserAccount : canBorrow() or internal check loanCount + 1 ≤ 5 → true (4+1 fits)
  4. LibraryManagementSystem → UserAccount : hasOutstandingFine() → false (balance 0)
  5. LibraryManagementSystem → Catalog : findCopies(title) → returns list; filter status = available → e.g., one copy copyID = B-142 available
  6. If all guards pass → LibraryManagementSystem → Loan : create(borrower, copy, dueDate) and copy.status := issued, borrower.loanList.add(loan), with return loanID to borrower. If any guard fails, return a failure signal indicating which rule blocked.

Design tasks exposed:

  • Ownership: Does UserAccount or a separate LoanPolicy / FineManager own the fine and limit checks? Assign to the Information Expert (the object that knows the needed state) per GRASP.
  • Sufficiency: Is the current object set sufficient or do we need FineManager, LoanFactory, or Reservation?
  • Signatures: Decide parameters and return values for each message so the flow is implementable: verify(cardID: String): AuthResult, findCopies(title: String): List<BookCopy>, createLoan(borrower: Borrower, copy: BookCopy, due: Date): Loan.

Sense-check: Walk through with numbers — borrower with 4 loans, fine 0, one copy available → succeeds and loanCount becomes 5; borrower with 5 loans or fine 150 → fails gracefully with explanatory return rather than creating a loan. The scenario validates that no check was skipped.

The same collaboration will reappear as a formal sequence diagram with lifelines, activation boxes, and guards (see 9.6, 9.8).

Assumptions & scope for this example:

  • Synchronous, single-thread control; no concurrent issuance of the same copy.
  • Cards are assumed valid/invalid via verify; external identity provider is out of scope.
  • Iteration over copies is bounded and small, so a simple loop suffices (see 9.8 iteration notation with *).

Real-world: The exact same structure — eligibility check → resource availability → conditional creation — appears in e-commerce order placement, hotel booking, and ticket reservation: a CustomerAccount check, a Inventory/Catalog check, then a Booking/Order creation guarded by the first two.

9.3.5 Student Questions and Answers

Q: How do we identify the objects that participate in "borrow a book"?

A: Start from real-world experience — the borrower, the library staff at the counter, the card, the catalog — and from the CRC idea of responsibilities and collaborators. For each responsibility ask "who should carry it?" Use brainstorming with CRC cards and play the scenario as messages. The analysis class diagram is a starting point, but design is free to rename, split, or merge objects and to introduce new conceptual helpers if a current object would become overloaded. That is precisely how Loan, FineManager, or Reservation may emerge — they are justified when they reduce coupling and improve cohesion.

Q: What is meant by low representational gap and why pursue it?

A: It means keeping the software model close to real-world concepts — same names, similar organization — so the distance between reality and the model is small. That closeness improves understanding, eases communication with stakeholders, and reduces mismatches between what is required and what is built. We achieve it by deriving software objects from real-world objects identified in analysis and refining them, while still allowing purely software concepts where a design invention improves structure.

9.4 Representing Design — UML Interaction, Class and State Diagrams

9.4.1 Interaction Diagrams as Core Design View

Hook: If a class diagram tells you what a library system contains, what tells you how it issues a book in six messages without losing track of time and links? The interaction diagram.

Formalize — dynamic vs. static:

  • An interaction diagram is the dynamic view that shows how objects exchange messages over time to realize a system operation. Every message sent to an object corresponds to a method on that object that will handle the request. Taken together, the message flows for all system operations define the method contracts of the whole design. Method contracts (operation contracts on post-conditions, inspired by T1 Ch. 11) may be used to specify the effect of each operation more precisely.

Two complementary forms express the same interaction, with a trade-off (T1 Ch. 15, T7 Ch. 7-8):

  • Sequence diagram — time ordering along vertical lifelines with activation (execution specification) bars. Read top-to-bottom.
  • Communication diagram — also called a collaboration diagram — emphasizes structural organization: objects as nodes, links as lines, messages annotated with numbering that recovers time order. More space-efficient on walls.

Use interaction diagrams as the core design view for exploring logic and behaviour. In agile whiteboard practice (T1 Ch. 14), the most challenging, interesting design work — "where the rubber hits the road" — happens while drawing these dynamic diagrams, not the class diagram.

Why they define methods: drawing verify(cardID) from System → UserAccount forces us to decide that UserAccount needs a method verify(cardID: String): AuthResult. The diagram is the decision.

Visual: a sequence diagram shows Borrower on the left, its dashed lifeline dropping down, a thin rectangle (activation) appearing on LibrarySystem when it is called, an arrow to UserAccount, a dashed return arrow carrying AuthResult back, and so on. The communication variant shows the same four objects as a diamond, links as undirected lines, and arrows labelled 1: requestIssue, 1.1: verify, 1.2: findCopies, 2: createLoan.

Scope & assumptions:

  • Assumes a single thread of control (synchronous messages with filled arrows); asynchronous stick-arrows and active objects are noted but not central here.
  • Diagrams are drawn primarily to understand and communicate, not to document for its own sake — a few hours per iteration on the hard parts suffices (T1 Ch. 14 guideline).

Pitfalls:

  • Class-diagram-first trap: spending all time on static structure and deferring interaction sketches until coding. This hides responsibility assignment errors until they are expensive.
  • Ignoring complementary form: using only sequence diagrams on a small wall where communication diagrams would be more space-efficient and easier to rearrange.

Real-world: POS NextGen (T1 case study) realizes the system operation enterItem(itemID, quantity) as an interaction: Register → ProductCatalog :: getProductDescription, Register → Sale :: addLineItem. Every message becomes a method; the diagram and the code co-evolve.

Recap — bridge: Interaction diagrams capture the dynamic conversation; class and state diagrams capture the static definition and lifecycle that support that conversation.

9.4.2 Class Diagrams and State Charts

Formalize:

  • A class diagram is the static view. Once the interaction view has defined methods and needed associations, the complete set of classes with attributes and methods can be drawn together. A complete class diagram — including method signatures with parameters and return types — can be turned into code through tooling or used as a blueprint for implementation skeletons (T1 Ch. 16; T7 Ch. 5).
  • A state transition diagram or state chart / state machine diagram (UML state machine, see T1 Ch. 29, T7 Ch. 9) models the dynamic behaviour inside a single object. It identifies distinct states the object can occupy, the events that cause transitions, and the operations active in each state. While interaction diagrams show between-object collaboration, state charts show within-object lifecycle.

Example given in lecture: a fan may be in an Off state or a Running / On state, with events switchOn / switchOff that switch between them. For software, a Loan might be in requested → issued → overdue → returned states, an Order in new → paid → shipped → delivered. State charts help identify the events (which become messages) and the methods that handle them, and they connect back to dynamic behaviour across the system where objects move from one state to another as messages are exchanged.

Relationship between the three views:

  • Interaction → discovers needed methods and links.
  • Class → records the resulting signatures and associations.
  • State chart → constrains which methods are valid when, preventing illegal transitions (for example return() only from issued).

Visual: a state chart for Loan shows rounded rectangles for states, arrows labelled issue(), markOverdue(), return() with guards such as [dueDate < today] on the transition to overdue. Reading it alongside the borrow-book sequence makes clear why createLoan must precede issue and why fine accrues only in overdue.

Scope:

  • State charts are worthwhile only for objects with a meaningful lifecycle (multiple states and event-driven change). An Author value object with no important state transitions may not need one.
  • Class diagrams at design time include design-only helpers (e.g., PaymentFactory) not present in the domain model.

Pitfalls:

  • Modelling every class with a state chart: clutter with no value. Focus on entities with distinct lifecycles (orders, bookings, lending records).
  • Inconsistency between views: a message shown in an interaction diagram but absent from the class diagram's method list, or a state transition with no triggering message.

Real-world: Code generators (e.g., Enterprise Architect, Visual Paradigm) take a design-level class diagram and emit Java/C# skeletons with attributes, getters/setters, and method stubs; developers then fill bodies guided by the interaction diagrams and state invariants.

9.4.3 Exam Notes

Exam note: For this subject, diagrams are central and some questions cannot be answered through text alone because UML diagrams must be drawn. Where a diagram is required, an upload facility for handwritten or tool-drawn answers is expected. A previous miscommunication where an instruction to allow uploads was not reflected consistently across courses was noted as a logistics error to be corrected, with explicit direction that questions requiring diagrams must permit uploaded answers.

Industry phrasing: expect to draw — not just describe — interaction diagrams (sequence and communication), class diagrams, and state charts. Where the question says "show with a sequence diagram" or "model the lifecycle", a text paragraph alone will be marked incomplete. Use upload as image/PDF where provided.

9.4.4 Industry Applications

Real-world: Teams use sequence diagrams to document message flow for any system event before coding, class diagrams as the blueprint that tooling converts to skeleton code, and state charts to model entities with distinct lifecycles such as orders, bookings, or lending records. Parallel modelling is common: five minutes on a wall of interaction diagrams, then five minutes on a wall of related class diagrams, keeping the two views consistent (T1 Ch. 14 agile modelling practice).

9.6 Sequence Diagrams — Time, Lifelines, Control Flow and Numbering

9.6.1 Time, Lifeline, Activation and Flow of Control

Formalize (T1 Ch. 15, T7 Ch. 7):

  • A sequence diagram shows message dispatch across a timeline. Each participating object or actor has a vertical dashed (or solid per UML 2) lifeline that represents its existence over time. The lifeline box at the top names the participant using the name : Type notation (e.g., a : Sale, :Sale for anonymous, sales[i] : Sale for a selected collection element).
  • A thin rectangle over the lifeline — the activation box (UML 2: execution specification bar) — shows when that object is actively processing a call, informally when the operation is on the call stack (focus of control). The bar is optional when wall-sketching but automatic in CASE tools.
  • Messages are drawn as horizontal arrows between lifelines in chronological order from top to bottom. The time aspect is implicit in that vertical order; reading downward follows the execution. A filled arrow head denotes a synchronous (blocking) call, an open stick arrow an asynchronous call (see 9.8). The starting message is a found message (solid-ball origin) whose sender may be unspecified.
  • A return (reply) can be shown either as result := message() or as a dashed return arrow closing the activation.
  • Flow of control or thread of control is the action sequence that threads through these messages. A sequence is a collection of messages dispatched one after another, potentially with branching (alt/opt frames) or iteration (loop frames). The diagram makes visible which object initiates each call, which object handles it, and how control returns to the caller.

Visual: draw three lifelines — Borrower, LibrarySystem, UserAccount. A found arrow requestIssue hits LibrarySystem, its activation starts, then a nested arrow verify goes to UserAccount which activates, then a dashed return AuthResult comes back, its activation ends, and LibrarySystem remains active. The vertical ordering tells the story without numbers.

Scope: Sequence diagrams excel at showing order and nested activation; they consume horizontal space quickly because new objects are always added to the right edge (T1 Ch. 15). For wall sketching with frequent rearrangement, communication diagrams (9.7) are more space-efficient.

Pitfalls:

  • Forgetting activation: drawing arrows without showing when each object holds control hides re-entrancy and overlap.
  • Assuming arrow shape is definitive: when wall sketching, many teams draw all arrows as stick arrows for speed regardless of synchronous vs. asynchronous intent (T1 guideline) — annotate if it matters.

Real-world: A reverse-engineered sequence diagram generated from running code is a favourite way to learn a legacy system's call-flow quickly, precisely because time is explicit top-to-bottom.

9.6.2 Sequencing and Numbering Options

Formalize — when numbers are needed:

Verbal forms captured: "you can give some flat numbering or procedural numbering when you are one after the other" and "numbering is required" versus "you don't need any numbering" depending on the diagram variant, and "flat sequencing as one two three four or nested sequencing as 1.1 1.2".

  • In sequence diagrams: numbering is optional because time is already encoded vertically. If used, it should follow procedural (nested) convention.
  • In communication diagrams: numbering is required to recover order because spatial layout carries no time.

Options, verified against T1 Ch. 15 (pp. 241–243) and T7 Ch. 8:

  • Flat numbering: — a simple total order.
  • Procedural or nested numbering: — reveals nesting: messages and are sent as part of handling message . Procedural numbering is popular because one high-level request naturally decomposes into several subsidiary messages needed to fulfill it.
  • Multi-thread / conditional path variants: separate top-level numbers or letters such as 1a / 1b distinguish concurrent threads or mutually exclusive conditional paths (see 9.8 for alt handling).

Guideline (T1): Do not number the starting message in communication diagrams; it simplifies subsequent nesting. Nesting is shown by prepending the incoming message number to the outgoing number.

The session stressed: "please use comments when you are drawing your diagrams" for ambiguity, but for ordering in sequence diagrams you may rely on vertical position alone.

Visual: flat list reads as a shopping list (1 do A, 2 do B, 3 do C); nested list reads as an outline (1 prepare, 1.1 chop, 1.2 boil, 2 serve), which mirrors the call stack.

Pitfalls:

  • Mixing flat and nested arbitrarily: switching mid-diagram without signalling nesting obscures parent-child causality. Pick one scheme per diagram and keep it.
  • Numbering sequence diagrams redundantly: adding flat 1,2,3 where vertical order already shows it adds visual noise; reserve numbers for communication diagrams or for procedural nesting that adds causal information.

9.6.3 Mathematical Formulation — Numbering and Control

Reconciled formulation (verified against T1 Fig. 15.27–15.28, T7):

General sequence pattern, described verbally as "flat numbering" and "nested sequencing":

where each or labels a message in execution order, and dotted suffixes indicate that the dotted messages are dispatched inside the handling of their parent message. This is procedural nesting. The unnumbered starting message msg1 may be present before 1: msg2 (T1 guideline).

A purely flat alternative of the same flow would be labelled:

but the nested form preserves the causal parent-child structure that the flat form loses. In UML communication diagrams, 1: create(cashier):Register → :Sale with nested 1.1: ... illustrates this (T1 Fig. 15.26–15.27).

Multi-thread/conditional extension:

where letters a, b mark mutually exclusive paths at the same sequence level (see 9.8).

All forms above are the standard UML sequencing verified in enrichment docs; lecture's "flat vs nested" phrasing maps directly to this.

9.6.4 Worked Example — Tracing Control with Lifelines

Worked example — New sale entry (POS NextGen style, mentioned under conditional messaging):

Suppose the top-level system operation is processSale triggered by Register. Two readings of the same collaboration:

Flat reading (total order only):

# Message From → To Return
1 enterItem(itemID, qty) Cashier → Register
2 findProduct(itemID) : ProductDescription Register → Catalog desc
3 createSalesLineItem(desc, qty) : SalesLineItem Register → Sale (Sale then create to SalesLineItem) sli
4 updateTotal() Register → Sale total: Money
5 finalize() Cashier → Register

Activation: Register stays active for 1–4, Catalog activates briefly for 2, Sale for 3–4. Return arrows (dashed) carry desc, sli, total back.

Nested reading (procedural, preferred):

  • 1: enterItem(itemID, qty)Cashier → Register
  • 1.1: findProduct(itemID)Register → Catalog → returns ProductDescription
  • 1.2: createSalesLineItem(desc, qty)Register → Sale
  • 1.2.1: create(qty)Sale → SalesLineItem (new lifeline starts at this height)
  • 1.3: updateTotal()Register → Sale
  • 1.3.1: *[i=1..n] getSubtotal()Sale → SalesLineItem[i] (iteration, see 9.8)
  • 2: finalize()Cashier → Register

Nested numbering makes the delegation visible: 1.1 and 1.2 only happen because 1 is being handled. If the diagram later adds a guard [isNewSale] on 1.2, the nesting tells the reader the creation is conditional on the outer operation.

Sense-check: Compare both: flat shows when each call happens; nested additionally shows why (parent handling). For a review, the nested form answers "who delegated to whom?" without tracing line intersections.

Real-world: When a sequence becomes crowded (more than ~8 messages), T1 advises splitting into one diagram per system operation of the current iteration rather than forcing an oversized sheet — exactly why enterItem and finalize are kept separate.

9.6.5 Industry Applications

Real-world: Teams split a complex interaction that would produce a crowded sequence diagram into several smaller diagrams, one per system operation of the current development cycle, so each diagram remains readable. Review guidance is that if a diagram becomes complex, it should be partitioned rather than forced onto a single oversized sheet. Modelling tools can then link those diagrams with ref / sd interaction occurrences (T1 Ch. 15, Fig. 15.19) to keep traceability across the set.

9.7 Communication Diagrams and Well-Structured Interactions

Formalize (T1 Ch. 15, T7 Ch. 8): A communication diagram — earlier name collaboration diagram — stresses the structural organization of objects and the links that join them. Instead of vertical time, the layout places objects as nodes (boxes) and draws links as lines annotated with numbered messages (arrows showing direction). The same lifecycle concepts as in sequence diagrams apply: construction via a create message (optionally stereotyped <<create>>), destruction via <<destroy>> / X where applicable, flow of control through the numbering, and self-messages (a link to itself) where an object does internal work such as recalculate().

Key structural property: links are instances of associations identified earlier (during domain or design class modelling). An association declared at class level (e.g., Sale —* SalesLineItem) becomes one or more links between specific object instances at runtime (sale:Sale — sli1:SalesLineItem). Only over such a link may a message be passed. Multiple messages, in both directions, flow along the same single link — the link is like a road allowing two-way traffic; it is not duplicated per message (T1 Fig. 15.23–15.24). This connection between static associations and dynamic links keeps the two views consistent.

Unlike sequence diagrams, time is not implicit. Order is recovered solely by the numbering (see 9.6.2). Hence placement of boxes is free in two dimensions, which is the diagram's space-economy advantage on walls.

Visual: four boxes in a diamond — Register, Sale, ProductCatalog, Payment — with links forming a mesh. Arrows labelled 1: makePayment, 1.1: create() ride the same link line, direction indicated by small arrowheads. A loopback arrow on Sale labelled 2: updateTotal shows a self-message.

Scope: Communication diagrams have fewer frame options than sequence diagrams (no built-in opt/alt/loop frames; guards and iteration are shown inline as [guard] and * [i=1..n]). For heavyweight branching, sequence diagrams with frames are clearer.

Pitfalls:

  • Drawing messages where no link exists: each arrow must be justified by an association in the class diagram. Adding an arrow without adding the association hides a design change.
  • Forgetting direction arrows: the line is the link; the small arrow is the message direction — omitting it leaves order ambiguous.

Real-world: On a physical whiteboard wall, a team can erase a Payment box from the lower right and redraw it near the Sale without redrawing the whole timeline — flexibility sequence diagrams lack.

9.7.2 Well-Structured Interactions

Formalize: Well-structured interactions are those that are efficient, simple, adaptable, and understandable — criteria the lecture stressed for evaluating candidate message arrangements:

  • Efficient — avoids unnecessary message round-trips (for example asking UserAccount once for a combined AuthResult rather than three separate calls for authentication, loan count, and fine).
  • Simple — messaging is regular and easy to follow; nesting reflects natural decomposition.
  • Adaptable — leaves room to vary behaviour without broad rewiring (e.g., adding a new loan rule touches only LoanPolicy, not every client).
  • Understandable — a newcomer can read the diagram and grasp why each message exists, because each answers an Information Expert / Creator rationale.

Related distinction (lecture vocabulary): concrete or prototypical objects refers to objects drawn directly from the real-world domain (e.g., BookCopy, Borrower) versus conceptual or abstract data type objects introduced purely for software organization, such as specification objects, policies, or coordinators with no physical counterpart. Both kinds may appear together; the conceptual ones are justified when they improve cohesion and reduce coupling, even though they widen the representational gap locally to narrow it globally.

Design evaluation therefore asks: does distributing checks to UserAccount and Catalog yield better structure than routing everything through one LibrarySystem coordinator?

Comparison — concrete-only vs. mixed modelling:

Dimension Concrete-only Concrete + conceptual helpers
Names Familiar immediately One extra concept to learn (e.g., FinePolicy)
Cohesion Risk of overloaded domain objects Higher — domain objects stay focused
Coupling May couple many clients to domain details Lower — clients depend on policy interface
When to pick Rules are simple and stable Rules are complex, shared, or varying

Assumptions: Efficiency here means conceptual efficiency (fewer conceptual steps), not measured runtime performance. True performance tuning is a separate concern.

Pitfalls:

  • Over-abstracting: introducing conceptual objects for every tiny rule, creating a maze of indirection.
  • Under-abstracting: refusing any conceptual object and letting one domain class accrue many unrelated responsibilities.

9.7.3 Worked Example — Publisher-Subscriber

Worked example — Publisher-Subscriber (Tata Sky / Tata Play notification model): This model was presented as an important recurring structure after the short break and is the behavioural Observer pattern in GoF terms (T1 Ch. 30+, T4/T5).

Setup: One publisher object (subject, e.g., ChannelPublisher : Publisher) and many subscriber objects (Viewer : Subscriber, :Subscriber instances). Subscribers attach themselves to the publisher to express interest. The operation described verbally: "you attach number of subscribers to a publisher and whenever some kind of activity is happening at the publisher you need to update — send the updates to each of the subscribers" and "you have registered for number of people are registered for a particular system event and they will be notified once an event is generated."

Concrete analogy used (professor's own, preserved): A television channel publisher such as Tata Sky or Tata Play holds channel offerings. Individual viewers subscribe to channels by attaching to the publisher. Whenever a channel change or other update occurs at the publisher (e.g., new channel added, price changed, schedule updated), every attached subscriber is notified and receives the current state — no polling needed.

Message flow (communication diagram numbering, per T1 Fig. 15.31–15.32):

Registration phase:

  • 1: attach(sub: Subscriber) — each Viewer → Publisher::attach(subscriber: Subscriber) — publisher stores subscribers: List<Subscriber>. For three viewers this is 1: attach(s1), 2: attach(s2), 3: attach(s3) or * : attach(s) as iteration.

Notification phase (upon event channelUpdated):

  • 1: notify() — internal event at Publisher (may be a self-message self.notify())
  • 1.1: *[i=1..n] update(state)Publisher → Subscriber[i] : update(event: Event) iterated over all n subscribers. In communication notation: 1 * [i=1..n]: update(state) or shorthand 1 *: update(). In sequence diagram variant no explicit numbering is strictly required because vertical order suffices; in communication diagrams numbering is required to show order.

Object vs. class diagram note (lecture): A class diagram describes publisher and subscriber types and their association (Publisher 1 — * Subscriber). An object diagram shows particular instances at a moment — which specific viewers v1:Viewer, v2:Viewer are attached right now. Object diagrams are instance snapshots that help validate that the class diagram, when instantiated, can represent actual runtime configurations.

Design insight emphasized: Deciding which objects participate and whether new objects are needed is itself part of the work. The publisher-subscriber split isolates notification logic in the publisher while keeping subscribers independent — subscribers do not know about each other, and the publisher does not know subscriber internals, only the update interface. This yields low coupling between publisher and subscribers and high cohesion within each role.

Sense-check: With n = 100 subscribers and one channelUpdated event, the publisher sends exactly 100 update messages, each to a distinct subscriber link — verified by the folded-rectangle comment practice (see 9.8) that clarifies "each message to a distinct instance" vs. "all to one collection object."

Scope: The lecture showed a push model (publisher pushes state). A pull variant exists where publisher only sends "changed" and subscribers fetch. Choice depends on update size and frequency.

Pitfalls:

  • Polling instead of push: having subscribers repeatedly ask "anything new?" Wastes cycles; the pattern's point is inversion — attachment once, then notification.
  • Forgetting to detach: subscribers that no longer need updates remain in the list, leaking memory and causing spurious notifications. Include detach(sub) in the design.

Real-world: UI frameworks (Swing listeners, JavaScript event emitters, Android LiveData), messaging buses (Kafka consumers subscribing to a topic), and news-feed services are all deployed publisher-subscriber instances. Recognising the pattern lets a reviewer instantly see where to expect attach/detach/notify and where iteration guards belong.

9.7.4 High Cohesion and Low Coupling

Formalize — the two cardinal GRASP evaluation principles (T1 Ch. 17, Larman):

  • High cohesion — each object or class has a focused, single-purpose set of responsibilities. Cohesion informally measures how functionally related the operations of a software element are and how much work it does. A Sale that knows its total via SalesLineItem collaborators is cohesive; a MonopolyGame that itself does database access, number generation, and UI work is not.
  • Low coupling — objects depend on as few other objects and as little of their internals as possible. Coupling measures how strongly one element is connected to, has knowledge of, or depends on others; when the depended-upon element changes, the dependant is affected.

They are linked: a low-cohesion object with many unrelated responsibilities naturally collaborates with many others, creating high coupling.

Most interaction designs are assessed against these two. A design that routes all library checks through one overloaded LibraryManagementSystem coordinator would be low cohesion and tightly coupled (every rule change touches the coordinator and many clients). A design that distributes checks to the objects that naturally own the information — asking UserAccount for fine and limit checks (Expert), Catalog for availability (Expert), LoanFactory or Loan for creation (Creator) — tends toward high cohesion and low coupling and is preferred all else equal.

Participants were asked to review these principles during the pause because the next block (9.8 onward) applies them to decide iteration, guards, and object creation placement.

Comparison — two borrow-book allocations:

Design A (centralized) Design B (distributed per Expert/Creator)
System does verify, checkLimit, checkFine, findCopies, createLoan System delegates: UserAccount.verify, UserAccount.canBorrow, Catalog.findCopies, Loan.create
Low cohesion — System knows too much, many methods Higher cohesion — each object handles its own data
Higher coupling — many clients couple to System internals Lower coupling — clients depend only on expert interfaces
Hard to adapt — new fine rule → edit System Easier — new rule → edit FinePolicy / UserAccount only

Pitfalls:

  • Dog-owns-Square anti-example (T1): Assigning getSquare(name) to Dog instead of Board because both could do it. Board already aggregates Squares, so giving it to Dog adds unnecessary coupling (Dog + Board both know Squares) and lowers cohesion.
  • Applying Low Coupling alone: favouring blind decoupling via excessive indirection can harm cohesion and readability. Evaluate both principles together.

Real-world: A code-quality gate in CI can approximate cohesion by class size and method count (e.g., flag classes >500 SLOC or >20 methods) and coupling by import count — heuristics, not proofs, but useful signals that a GRASP review should follow.

9.7.5 Student Questions and Answers

Q: For publisher-subscriber, do subscribers poll or does the publisher push?

A: The pattern described is push-based: subscribers attach once, and the publisher pushes notifications (update/notify) to each subscriber whenever a relevant activity occurs. That is why the publisher maintains the subscribers collection and sends individual update messages on each event rather than requiring subscribers to poll. (A pull variation exists but was not the model taught here.) This inversion is the whole advantage — subscribers remain passive and decoupled from polling timing.

9.8 Detailed UML Notations — Iteration, Guards, Multi-Objects and Static Calls

9.8.1 Core Visual Rules

Formalize (T1 Ch. 15, T7 Ch. 7–8): Two simple visual rules were stressed and are the foundation for all detailed notations that follow:

  1. Object vs. class notation — the colon: An object box shows naming as name : Type, for example or . Before the colon is the object name (instance identifier); after is the class (type). If only a type is shown (:Sale) it represents an anonymous object. If a selector is shown (sales[i] : Sale or lineItems[i] : SalesLineItem) it denotes one element selected from a collection. Before the colon → object; after → type.

A box showing only a class name with no colon — e.g., ProductCatalog or Calendar or Math — denotes the class itself (more precisely, an instance of a metaclass Class), meaning a static / class-level call. This distinction matters for ProductCatalog.getInstance() (static) vs. aCatalog.getProduct(...) (instance).

  1. Links before messages: Before sending a message, a link must exist between the two objects (association instance). The link is the precondition for communication; showing a message without a justifying link is a review fault.

Every message may list parameters with types after a colon — op(p1: T1, p2: T2) : TReturn — and a return type may be declared as in . Message numbering supplies order, and where an assignment results, the notation shows the receiving variable, the type, and the operation (d := getProductDescription(id: ItemID) : ProductDescription per T1).

Visual: aSale : Sale has a colon and two compartments (object name left, type right); Sale alone has none and suggests Sale.getInstance() is a static factory call. The link line between Sale and SalesLineItem is the road; the arrow getSubtotal is the vehicle.

Pitfalls:

  • Forgetting the colon: writing aSale Sale without : confuses reviewers about instance vs. class.
  • Static vs. instance mix-up: calling Calendar.getAvailableLocales() as if it needed a Calendar instance, when the notation deliberately shows Calendar without colon to signal a metaclass/static access.

9.8.2 Mathematical Formulation — Iteration, Guard and Comments

Reconciled formulations (verified against T1 Ch. 15 Figs. 15.16–15.17, 15.31–15.32; T7):

Iteration with unknown count, described verbally as "iterations are shown by in star so number of sales line item would be there in a particular sale so one sale will have number of sales line item that you can show as an iteration no recurrence value" and "if you know the recurrence value you can show within brackets this is your guard condition so one to n" and options "you can use i colon one to n and you can use star any one is fine":

Unbounded iteration (star alone):

where preceding the message denotes "for each element in the associated multi-object." In communication diagrams this appears as 1 *: st := getSubtotal (less precise shorthand, see T1 Fig. 15.31). It means "repeat without stating the bound" — the collection size is unspecified or not important.

Bounded iteration with recurrence value / guard form:

or equivalently with explicit assignment guard:

and the concrete T1 style with full message:

where is the iteration variable ranging over to , is the number of items, and the bracketed guard indicates the repetition condition. In sequence diagrams the same is shown as a loop frame with guard [i < lineItems.size] and an action box i++ (T1 Fig. 15.16). An alternative concrete cap noted verbally as "you can say that only 10 items maximum you can add" would reconstruct as or depending on openness; keeping the range open as leaves the count unspecified.

Conditional / guarded messaging, described verbally as "conditional messaging as the guard messages guard conditions if it is true then only message would be sent if it is a new sale then only a create new sale message would be sent" and "usually exclusive messages you can send based on the conditions not or true so either this one or this one would be executed":

where each bracketed condition is a guard; the guarded message is dispatched only when the guard evaluates to true. In UML 2 sequence diagrams a single conditional is shown with an opt frame whose guard is placed over the lifeline (T1 Fig. 15.13); mutually exclusive paths use an alt frame with guards such as [color = red] vs. [else] (T1 Fig. 15.15). In communication diagrams guards are inline: 1 [color = red]: calculate (T1 Fig. 15.29) and with path letters 1a [test1]: msg2 vs. 1b [not test1]: msg4 (T1 Fig. 15.30).

Unconditional messages carry no guard and are dispatched regardless:

Self-message for internal processing, described verbally as "message to self whenever you are doing something clearing itself or calculating or processing some work you can send a message to self":

In communication diagrams this is a link to itself with 1: clear (T1 Fig. 15.25); in sequence diagrams a nested activation bar.

Comments for ambiguity removal, described verbally as "notation for comment is your folded rectangle" and "for removing any ambiguity in the diagrams you need to specify that in the comments so please use comments when you are drawing your diagrams":

\text{comment : } \fbox{\parbox{...}{\text{all 10 messages go to the same SalesLineItem vs each to a distinct item}}}

where the folded-corner rectangle (UML note) is placed adjacent to the ambiguous region with a dashed lead line. The precise idiom for iteration-over-collection uses a note to clarify whether the batch of messages fans to one collection object or to distinct element objects (see 9.8.3).

All guards, stars, and comment rectangles above are the standard UML iteration/guard/comment notations verified in the enrichment docs; the lecture's "star", "recurrence value", "guard condition" vocabulary maps exactly to them. No new major topic is introduced — only the standard supporting detail that makes the formulas complete.

Visual: a loop frame labelled [i = 1..n] surrounds arrows fanning to a box lineItems[i] : SalesLineItem; next to it a folded rectangle says "each arrow to a distinct SalesLineItem". Without that note, a reviewer cannot tell if one message goes to the collection or messages go to elements — the very ambiguity the note resolves.

9.8.3 Worked Examples — Sale and SalesLineItem Iteration

Scenario — One Sale aggregates many SalesLineItems (T1 domain: Sale 1 —* SalesLineItem): Two equivalent multi-object notations were given, both acceptable (T1 notes both as valid conventions; teams pick one):

Notation variant A — stacked shadow (compact, UML multi-object): A multi-object symbol shown as overlapping rectangles (staggered/shadowed) labelled or to indicate a collection of an unspecified number or 10 instances. Example label: as single object linked to a multi-object . In some renderings written as :SalesLineItem* or lineItems : List<SalesLineItem>.

Notation variant B — explicit collection size (explicit label): Label as or / lineItems[i] : SalesLineItem with an external loop guard. Both are acceptable; the first is more compact, the second more explicit about selection.

Iterative message over the collection, case 1 — operation on each element individually: To compute subtotals for each line item, the Sale sends individually to each SalesLineItem:

In communication style (more standard, per T1): 1 * [i = 1..n]: st := salesLineItem[i].getSubtotal() : Money where is the current number of line items (lineItems.size = e.g., 3). In sequence style: a loop frame with guard [i < lineItems.size] enclosing st := getSubtotal, with selector lineItems[i] : SalesLineItem and increment i++ action box.

Concrete numbers: Sale with lineItems = [sli1(qty=2, price=10), sli2(qty=1, price=30), sli3(qty=5, price=2)] → iteration sends 3 messages, returns 20, 30, 10, sum 60. The diagram fans n arrows to n distinct SalesLineItem instances.

A double-star nuance was noted: one star marks iteration over the multi-object, a second star when the messages fan to each individual element inside the collection, ensuring readers do not confuse "send one message to the collection object (e.g., lineItems.getTotal())" with "send messages to elements." Clarify with the folded-rectangle comment.

Iterative message, case 2 — collection-level operation via element creation: First create a new element, then add it to the multi-object:

In UML terms: Sale → SalesLineItem : create(quantity, product) (dashed <<create>> arrow) then Sale → :List<SalesLineItem> : add(sli). This corresponds to code SalesLineItem sli = new SalesLineItem(qty, desc); lineItems.add(sli); (T1 Fig. 17.13 Creator pattern — who creates SalesLineItem? Sale, because it contains them).

The earlier folded-rectangle comment is then used to resolve the ambiguity explicitly: a note stating "either all 10 messages will be going to first b or c that you can specify" clarified by writing in the comment whether each of the 10 messages targets the same recipient (one object receives 10 calls) or distinct recipients (10 distinct objects each receive one). In graded diagrams, the presence of this note separates a complete answer from an ambiguous one.

Static / class-level message, described verbally as "messages that you are sending to a particular class so class there is no colon a particular object and any message method that is sent to a class that's a static method":

where notation shows no colon between name and type — the box is labelled simply with the class name, e.g., ProductCatalog or Math or with stereotype <<metaclass>> Calendar, indicating a static method belonging to the class (instance of metaclass Class) rather than to any single instance. Example from T1: Calendar.getAvailableLocales() : Locale[] sent to <<metaclass>> Calendar (T1 Fig. 15.20, 15.33). Code: Locale[] locales = Calendar.getAvailableLocales();.

Conditional creation example (guards govern creation):

In sequence terms: an opt frame with guard [isNewSale] encloses create(sale : Sale) and subsequent create SalesLineItem messages. If evaluates to false (e.g., adding to an existing sale), the creation message and subsequent element creations are omitted. Exclusive branching with guards such as [condition] versus models alternative flows where only one branch executes — e.g., [x>0] processPositive() vs [\text{not } x>0] processNegative() inside an alt frame.

Sense-check: For isNewSale = true, one new Sale and one SalesLineItem are created; for false, zero Sale creations, one SalesLineItem added to existing sale — the diagram's object count matches the code's new count, and the guard explains the difference.

Real-world: In transaction-heavy domains (POS sales, loan processing), iteration over SalesLineItems / LoanItems with an explicit star or loop frame is a literacy expectation — reviewers check that the diagram distinguishes "message to collection" from "message to each element" via notation plus comment.

9.8.4 Message Types Consolidated

Synthesis — all message types that may appear in a design (expanded from T1 Ch. 15):

  • Signal — a one-way notification that some activity happened, modelled as a message without expecting a return, e.g., "send a signal that this has happened just triggering some particular thing." Notation: open or filled arrow without return assignment.
  • Call — invocation of an operation that may return a value, the most common form. Example: d := getProductDescription(id).
  • Create — instantiation via <<create>> stereotype or new/create message; "new also can be used but create message is very common." Creation is typically assigned to the participant that holds the most information needed to initialize the new object (Creator principle). Shown as dashed arrow with filled head in sequence diagrams; 1: create(cashier) in communication diagrams.
  • Destroy — deletion of an object; signalled by <<destroy>> and X at end of lifeline. Relevant outside automatic garbage collection contexts (C++), or to indicate logical end-of-usefulness (closed connection).
  • Self-call — internal processing on the same object, drawn as a loopback arrow / nested activation. Example: Sale.recalculateTotal().
  • Return — dashed arrow carrying a value back to the caller, closing the activation. Can also be shown as result := message().
  • Static / class messageClassName.operation() to a box with no colon, indicating a call on the class/metaclass object.
  • Guarded / iterated messages — any of the above prefixed with [guard] or * [i=1..n] per 9.8.2.

A single interaction may contain all of these: a create, several guarded calls, an iteration with *, a self-call, and a destroy.

Visual: a legend with seven tiny icons — solid arrow (call), dashed arrow (create), loop (self), X (destroy), rectangle with folded corner (comment), * prefix (iteration), [ ] prefix (guard) — next to one-sentence meaning.

Pitfalls:

  • Missing guard brackets: writing isNewSale create without [ ] leaves conditionality implied, not explicit.
  • One star vs. two stars confusion: not annotating whether iteration fans to one collection object or to many elements — always add the folded comment when ambiguity exists.
  • Self-call vs. call to another of same type: a loopback arrow means "same instance"; an arrow to another box labelled :Foo means "different instance of same class" — label carefully.

9.8.5 Industry Applications

Real-world: The recurrence guard , the bare star for open iteration, the guard brackets for conditionals, the folded-rectangle comment for ambiguity, and the two multi-object notations are all treated as literacy expectations in industry design reviews, where an unambiguous diagram must be complete enough to hand to programmers for implementation without further clarification. A reviewer who sees a bare * without a collection selector will ask "which multi-object and how many?" and a reviewer who sees ten parallel arrows without a comment will ask "same recipient or distinct?" — both are completeness defects.

9.9 Completeness, Comments and Guidance for Executable Design

9.9.1 Completeness and Ambiguity Reduction

Formalize — what "complete" means for handover:

A design must be complete — sufficient for a programmer to implement without guessing. That means:

  • Every required object (including conceptual helpers like Sale, Payment, FinePolicy where justified) appears.
  • Every link needed for messaging is present — each arrow is justified by an association/visibility.
  • Every guard and iteration count is stated or deliberately left open with an explicit unbounded star (*) — not omitted by accident.
  • Every conditional vs. unconditional message is explicit ([guard] present or absent deliberately).
  • Any residual ambiguity — notably whether a batch of messages targets one instance or many distinct instances — is closed by a folded-rectangle comment (UML note) with a dashed lead line to the ambiguous region.

The session stressed "please use comments when you are drawing your diagrams" to eliminate the question of whether a batch of messages targets one instance or many, and to note side conditions — in plain words: "no diagram is complete without an unambiguous diagram." Comments are not decoration; they are part of the contract.

Completeness checklist (used in reviews):

  • Object boxes have correct colon notation (name : Type vs. Class for static).
  • Parameters and return types are typed (p: Type : Return).
  • Links exist for every message.
  • Iteration (*, * [i=1..n]) and guards ([cond]) cover all branching.
  • Creation/destroy lifecycle shown where relevant.
  • Folded comment present where fanning ambiguity exists.

Visual: a before/after. Before: ten arrows fanning to a single SalesLineItem box with no note — ambiguous. After: same arrows with a folded rectangle attached saying "each of the 10 messages goes to a distinct SalesLineItem instance, sli[i] for i=1..10" and a selector lineItems[i] : SalesLineItem on the lifeline.

Scope: Complete does not mean exhaustive detail of every utility method. Focus on the system operations of the current iteration (e.g., borrowBook, enterItem, makePayment) and on the domain objects with meaningful collaboration. Infrastructure concerns (logging, persistence) may be deferred if they are not the iteration's risk.

Pitfalls:

  • Invisible iteration bound: writing * where n=3 is known and invariant — reviewers will ask whether the bound is truly unspecified or you simply omitted it.
  • Over-commenting trivial diagrams: a simple two-message interaction needs no folded note; reserve comments for genuine ambiguity.

Real-world: In a handover review before coding, the completeness gate is binary: either the diagram set is unambiguous enough to generate skeleton code without questions, or it is returned with "add guard here, add comment there." This front-loading reduces downstream defects because implementers never need to infer intent that should have been explicit.

9.9.2 Practical Sequencing Conventions

Conventions that keep diagrams readable (aligned with T1/T7):

  • Procedural numbering: top-level messages numbered and their internal delegations numbered and so on, including for the next decomposition (e.g., 1: enterItem, 1.1: getProductDescription, 1.2: create SalesLineItem, 2: getTotal, 2.1: getSubtotal). This makes delegation visible and keeps branching readable.
  • Alternative flows: exclusive guarded messages ([cond] vs. [\text{not } cond] or 1a vs. 1b branches) show that only one of a set executes. In sequence diagrams these sit inside alt / opt frames.
  • Unconditional messages: no guard bracket is needed — their absence means unconditional; do not add [true].
  • Creation as a step: where a message creates an object, it conceptually counts as the next sequential step (for example as the third or fourth message in the operation's flow) so its new lifeline starts at the point of creation, not at the top of the diagram. Subsequent messages that involve the new object only appear after its creation point.

Tiny illustration — incrementing a loan count:

  • 1: verify(cardID) : AuthResult — unconditional, must always happen first.
  • 2: [isValid] checkLimit() : Boolean — conditional.
  • 3: [isValid && withinLimit] create(loan : Loan) — creation only on the success path; loan lifeline starts here.
  • 3.1: add(loan) — nested under creation, on the same success path.
  • 4: updateCatalog() — unconditional, after branching converges.

Numbering tells the reader both order and causality without tracing line crossings.

Pitfalls:

  • Monolithic diagram: trying to show every alternative (isValid true/false, available true/false, limit ok/exceeded) in one diagram with deeply nested alt frames. The T1 guideline is to split into smaller, operation-specific diagrams — one per success/failure scenario — linked with ref/sd frames if needed.

Where next: The next step in the course will move from notation mastery to principle application: completing the review of the GRASP set — five patterns have been introduced so far and four remain (Pure Fabrication, Indirection, Polymorphism, Protected Variations — see T1 Ch. 25) — and then showing how to create collaboration and sequence diagrams from the motivating principles rather than by rote.

Concretely, the workflow practiced going forward is:

  1. Start from the system sequence diagram (system operations).
  2. Ask RDD/GRASP questions (Expert, Creator, Low Coupling, High Cohesion) to decide "who should do what?"
  3. Sketch the interaction that answers that question (sequence or communication).
  4. Record the resulting methods in the class diagram and the lifecycle in the state chart.

In parallel, keep reviewing: class diagrams (static view, T1 Ch. 16), sequence and communication diagrams (dynamic view, Ch. 15), and state transition diagrams (lifecycle view, Ch. 29) so that each informs the others rather than living as isolated artefacts. The textbook's inside-front-cover GRASP summary and the agile "several models in parallel" practice are the revision aids.

9.9.4 Industry Applications

Real-world: Complete designs that explicitly mark iteration, guards, multi-objects, static calls, and comments reduce downstream defects because implementers do not need to infer intent. The practice of splitting any operation whose interaction becomes complex into smaller, operation-specific diagrams is similarly a scale practice that keeps reviews tractable. In large codebases, a ref frame lets a high-level borrowBook diagram delegate to a detailed checkEligibility sub-diagram without entangling them — exactly the modularity that pattern-based design aims for.

Exam Guidance Summary

Exam note: Object oriented design and analysis with UML is inherently diagram-centric. Text-only answers cannot represent UML relationships, lifelines, messages, guards, and multi-objects with full fidelity. For any question that asks for a diagram, the examination setup must permit uploading an answer as an image or PDF, and students should expect to draw interaction diagrams, class diagrams, and state charts. A prior inconsistency where admin communication about text-only submission was applied uniformly across courses, even to this diagram-heavy course, was acknowledged as a logistics issue. Direction had been given before the examination that questions requiring diagrams must allow uploads, including a 15-minute upload window where applicable. Where that window was missing or where an Excel sheet of per-course instructions conflicted with the actual question paper, the gap was attributed to communication error in exam administration, not to course design, and was to be taken up with the administration team. The expected resolution is that future administrations will show the available submission options in full view and honour diagram uploads for this subject.

Exam note — what to study for this lecture: Learn notation for class diagrams, sequence diagrams, communication diagrams, and state transition diagrams — including lifeline/activation, message syntax (p: Type : Return), links vs. associations, flat vs. procedural numbering, iteration (* and * [i=1..n]), guards ([cond] and alt/opt), multi-object variants, static calls (no colon), self-calls, create/destroy, and folded-rectangle comments. Review the nine GRASP patterns — five covered so far (Creator, Information Expert, Low Coupling, High Cohesion, Controller) and four to follow (Pure Fabrication, Indirection, Polymorphism, Protected Variations) — and be ready to apply them to decide who creates, who knows, and who coordinates. A diagram question will expect a sketched UML diagram uploaded as image/PDF, not a textual description alone. Hand-drawing with correct UML conventions is acceptable; tool-drawn is also acceptable.

No additional mark distribution or chapter numbers were specified in this session beyond that guidance. Focus on applying principles while sketching interactions, not on memorizing UML version trivia.

Key Industry Applications

Synthesis — where this lecture's ideas land in practice:

  • UML interaction modelling as the dynamic backbone: Teams document every system operation (e.g., borrowBook, enterItem, makePayment) as a sequence or communication diagram that shows time-ordered message flows over declared links, with explicit control over iteration (*, * [i=1..n]), guards ([cond], alt/opt), and branching. These diagrams define the methods; the class diagram then records them.
  • Class diagrams as executable blueprint: The static view ties those dynamic flows to concrete method signatures with typed parameters and return values (total: Integer := getTotal(): Integer). Tooling (Enterprise Architect, Visual Paradigm, Eclipse/Visual Studio plugins) generates skeleton code from a complete class diagram; developers fill bodies guided by the interaction contracts. This is "draw, then code" done in a lightweight, iteration-sized way, not big upfront modelling.
  • State charts for lifecycle entities: State transition diagrams capture states and event-driven transitions for entities with dynamic behaviour. The fan example (Off vs. On/Running) generalizes to a book loan (requested → issued → overdue → returned), an e-commerce order (new → paid → shipped → delivered), a booking, or a payment. State charts identify which messages/events are valid when and prevent illegal transitions long before testing.
  • Publisher-subscriber / Observer for event notification: A widely deployed pattern for decoupling. A publisher (e.g., ChannelPublisher, e.g., Tata Sky / Tata Play in the lecture) maintains attach/detach and pushes update to each subscriber on change — no polling. Same shape reappears in GUI listeners, message buses, and notification services. Recognising it lets a team reuse the attach → notify → update template with confidence.
  • GRASP + GoF as the decision vocabulary: Nine GRASP patterns (Larman) for responsibility assignment — Creator (who creates), Information Expert (who knows), Low Coupling, High Cohesion, Controller (who coordinates the UI → domain handoff), plus the remaining four (Pure Fabrication, Indirection, Polymorphism, Protected Variations) — together with the 23 Gamma (GoF) patterns (Factory, Observer, Strategy, etc.) give a shared language grounded in high cohesion and low coupling. Decisions quote the pattern ("Creator here because Sale contains SalesLineItems") rather than relying on taste. Composition and aggregation are favoured over unchecked inheritance.
  • CRC workshops before UML commitment: Class-Responsibility-Collaboration cards support low-cost collaborative exploration. Playing a scenario with cards surfaces missing objects (e.g., discovering FinePolicy) and evaluates overload before the diagram is inked.
  • Design completeness as handover gate: Explicit multi-object notation (stacked shadow vs. explicit collection, both acceptable), star iteration, recurrence guards, guard conditions, exclusive branching, self-calls, create/destroy lifecycle, class-level static messages (no colon), and folded-rectangle comments for ambiguity — together constitute the definition of done before implementation, particularly in transaction-heavy domains where a Sale aggregates many SalesLineItems and correctness depends on distinguishing "one message to the collection" from "n messages to n elements."

OODAP Lecture 9 notes · Object Oriented Design with UML Interaction Models

Object Oriented Design, Analysis and Programming Architecture· postgraduate· 2026-08-19

Sections Breakdown

19.1 Design as a Creative Solution Activity and the Need for Principles

Opens the black box: from domain model to software objects defined by state and behaviour, needing UML notation and principles (theorem-like rules) to evaluate alternatives.

29.2 Reusable Solutions — Patterns, Productivity and Guarantee

Patterns as named problem-solution templates (GoF 23, GRASP 9); reuse saves time but crucially supplies proven guarantee and shared vocabulary.

39.3 Objects, State, Behaviour, and Collaboration

Objects hold state and expose behaviour as black boxes; systems are communities collaborating via messages over links, explored with CRC cards and low gap.

49.4 Representing Design — UML Interaction, Class and State Diagrams

Interaction diagrams (sequence vs communication) are core dynamic view defining methods; class diagrams are static blueprint; state charts model single-object lifecycle (fan, Loan).

59.5 Messages, Links, and Responsibility-Driven Design

Message = service+params+return realised as method call; link = association instance required for messaging; RDD asks who should do what (GRASP).

69.6 Sequence Diagrams — Time, Lifelines, Control Flow and Numbering

Sequence shows lifeline, activation, top-to-bottom time, flow of control; numbering optional (procedural nested vs flat) vs required in communication.

79.7 Communication Diagrams and Well-Structured Interactions

Communication stresses structure/links with numbered messages; publisher-subscriber push model exemplifies well-structured, high cohesion/low coupling design.

89.8 Detailed UML Notations — Iteration, Guards, Multi-Objects and Static Calls

Colon distinguishes object vs class; guards [cond], iteration * and * [i=1..n], multi-object stacked vs explicit, static call without colon, self-call, comments disambiguate fanning.

99.9 Completeness, Comments and Guidance for Executable Design

Complete design is unambiguous for programmers: all objects/links/guards/iterations present, comments resolve fanning, sequencing follows procedural numbering; next is applying GRASP to create interactions.

10Exam Guidance Summary

Diagram-centric exam requires upload for UML; study class/sequence/communication/state notations and all nine GRASP patterns (five covered, four next).

11Key Industry Applications

Industry uses interaction->class->state pipeline, code generation, Observer/publish-subscribe, GRASP/GoF vocabulary, CRC workshops, and completeness gate with explicit UML notations.

Postgraduate students in Object Oriented Design, Analysis and Programming

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Design as a Creative Solution Activity and the Need for Principles

Must-know: Design defines software objects (state+behaviour) inspired by domain objects; methods are primary addition and design must be complete for code generation (three compartments).

⚠️ Top pitfall: Copying domain objects 1:1 without asking who should do what; sketching only class diagrams and postponing interaction flows.

Self-check: What is added in design that was absent in the conceptual class diagram, and why is a principle needed to choose among alternatives?

Connects to: 9.2, 9.3

Reusable Solutions — Patterns, Productivity and Guarantee

Must-know: Pattern = named recurring problem + general solution (not code); GoF 23 and GRASP 9 are the course collections; reuse gives time + guarantee.

⚠️ Top pitfall: Calling reduce redundancy the whole benefit; treating pattern as literal rule (e.g., always Board creates Squares even when Factory needed).

Self-check: Why is guarantee the deeper benefit of reuse than just reducing redundancy?

Connects to: 9.1, 9.7

Objects, State, Behaviour, and Collaboration

Must-know: Object = state+behaviour black box; message = service name+params+return; link = association instance; CRC brainstorms responsibilities; low gap keeps names close to reality; borrow-book flow shows 5 checks and who owns them.

⚠️ Top pitfall: Anaemic objects or exposing attributes directly; forgetting state-dependent operations (e.g., return only from issued).

Self-check: In borrow-book, which two objects own fine/limit vs availability per Expert, and when would you add a FinePolicy?

Connects to: 9.5, 9.7

Representing Design — UML Interaction, Class and State Diagrams

Must-know: Interaction diagrams define methods (every arrow = method); sequence shows time vertical, communication shows structure with numbering; class diagram is complete blueprint for codegen; state chart shows inside-object states/transitions.

⚠️ Top pitfall: Modelling only class diagrams and deferring interaction sketches where real design decisions happen.

Self-check: What view does each diagram type provide and which one discovers needed methods?

Connects to: 9.6, 9.8

Messages, Links, and Responsibility-Driven Design

Must-know: Message syntax return = message(p:Type):Return; link must exist; RDD; create/destroy lifecycle via <<create>>.

⚠️ Top pitfall: Sending message where no link/association exists; centralising all messages on one coordinator.

Self-check: Distinguish message vs method and write general signature with params and return.

Connects to: 9.6, 9.8

Sequence Diagrams — Time, Lifelines, Control Flow and Numbering

Must-know: Sequence time is vertical; filled=sync, stick=async; activation = on stack; flat vs procedural nested numbering; numbering optional in sequence, required in communication.

⚠️ Top pitfall: Mixing flat and nested arbitrarily; numbering sequence diagrams redundantly where vertical order suffices.

Self-check: When is numbering required vs optional, and what does 1.1 mean relative to 1?

Connects to: 9.7, 9.8

Communication Diagrams and Well-Structured Interactions

Must-know: Communication: boxes anywhere, links = association instances, order via numbers; publisher-subscriber is attach once -> push notify; well-structured = efficient/simple/adaptable/understandable; high cohesion vs low coupling evaluation.

⚠️ Top pitfall: Letting subscribers poll instead of push; forgetting detach/leak; routing all checks through one coordinator.

Self-check: Why does publisher-subscriber achieve low coupling and how is it push not poll?

Connects to: 9.5, 9.8

Detailed UML Notations — Iteration, Guards, Multi-Objects and Static Calls

Must-know: Object a:Sale vs class Calendar; * unbounded, *[i=1..n] bounded; [guard] conditional, alt/opt frames; static = no colon; self-call loopback; folded comment resolves collection vs element ambiguity.

⚠️ Top pitfall: Missing [ ] on guard; confusing one star (to collection) vs two stars (to elements); not adding comment for 10-arrow fan-out.

Self-check: Write bounded iteration over SalesLineItems and explain static call notation difference.

Connects to: 9.6, 9.9

Completeness, Comments and Guidance for Executable Design

Must-know: Complete = every object/link/guard/iteration explicit, ambiguity closed by note; use procedural numbering 1,1.1,2.1; creation starts lifeline mid-diagram; split complex diagrams per operation.

⚠️ Top pitfall: Leaving iteration bound or guard implicit; cramming all alternatives into one monolithic diagram instead of splitting.

Self-check: What belongs on the completeness checklist for a handover-ready interaction?

Connects to: 9.8

Exam Guidance Summary

Must-know: Exam requires drawing class/sequence/communication/state diagrams via upload; learn GRASP 9 (5 covered, 4 next).

⚠️ Top pitfall: Attempting to answer diagram questions with text only.

Self-check: Which diagram types and GRASP count are examinable from this lecture?

Connects to: 9.4

Key Industry Applications

Must-know: Sequence/communication document flows; class diagram is codegen blueprint; state charts for lifecycles; Observer = publisher-subscriber; GRASP/GoF for decisions; CRC for exploration; completeness gates handover.

⚠️ Top pitfall: Handing ambiguous diagrams to programmers expecting inference.

Self-check: Name three industry practices that directly reuse this lecture’s models.

Connects to: 9.3, 9.7

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.