Software Engineering & Object-Oriented Analysis & Design β Object-Oriented Fundamentals and Analysis, NEC licence examination syllabus (Nepal Engineering Council).
Representation of System Behavior
Describing what the system does, as a black box, before deciding how.
π Where this lives: the black-box discipline in this topic is exactly what an API specification does. When you read the documentation for a payment provider, you learn what each call does, what it requires beforehand and what is true afterwards β and nothing about the internal design, which is theirs to change. Specifying behaviour at the boundary before designing the interior is what allows the interior to be redesigned later without breaking anyone. Search "black box specification postcondition API contract".
System sequence diagrams
A SYSTEM SEQUENCE DIAGRAM (SSD) illustrates INPUT AND OUTPUT
EVENTS related to the system under discussion, for ONE SCENARIO
of a use case.
THE ESSENTIAL DISCIPLINE: the system is drawn as a SINGLE BLACK
BOX. There are no internal objects, because we are still in
analysis and the internal design does not yet exist. The
diagram shows only what crosses the boundary.
WHY THIS MATTERS: an SSD identifies the SYSTEM OPERATIONS β
the operations the system as a whole must offer. Those
operations become the starting point for design: each one gets
a controller and a collaboration that realises it. Skip the
SSD and design begins without knowing what the system's public
behaviour is.
A WORKED SSD for the main success scenario of UC-05:
:Counter Officer :System
β β
β enterApplication(no) β
ββββββββββββββββββββββββββΆβ
ββ - - - - - - - - - - - -β application details, feeDue
β β
β confirmIdentity(no) β
ββββββββββββββββββββββββββΆβ
ββ - - - - - - - - - - - -β verification result
β β
β recordPayment(no, amt, β
β method) β
ββββββββββββββββββββββββββΆβ
ββ - - - - - - - - - - - -β receipt
β β
β issueLicence(no) β
ββββββββββββββββββββββββββΆβ
ββ - - - - - - - - - - - -β licence number
β β
NOTATION:
solid arrow a message / request into the system
dashed arrow a return of information
vertical line the LIFELINE of a participant
tall thin box an ACTIVATION (optional in an SSD)
frames loop, alt, opt for repetition and
alternatives
THE FOUR SYSTEM OPERATIONS EXTRACTED:
enterApplication(applicationNo)
confirmIdentity(applicationNo)
recordPayment(applicationNo, amount, method)
issueLicence(applicationNo)
NAMING SYSTEM OPERATIONS: use a verb phrase in the imperative,
starting with a verb, at the level of the user's INTENT rather
than the UI mechanics. `enterApplication` not `onSubmitClick`;
`issueLicence` not `updateStatusToIssued`. The name should
survive a change of user interface.
ONE SSD PER SCENARIO, not per use case. The main success
scenario gets one; a significant alternative may get another.
Do not attempt to draw every extension β that is what the
written use case is for.
EXTERNAL SYSTEMS APPEAR AS ACTORS on their own lifelines, since
they are outside the boundary:
:System βββ verifyIdentity(citizenId) βββΆ :NationalIdService
which makes the external dependency visible, and is where the
availability arithmetic from the inter-organisational topic
gets its input.
Operation contracts
An OPERATION CONTRACT describes what a system operation does, in
terms of STATE CHANGES to the objects in the domain model, using
preconditions and postconditions.
THE TEMPLATE:
OPERATION the name and parameters
CROSS REFERENCES the use cases this can occur in
PRECONDITIONS assumptions about the state of the
system BEFORE execution β noteworthy
assumptions worth telling the reader
POSTCONDITIONS the state of the objects in the domain
model AFTER completion
THE POSTCONDITION IS THE HEART OF IT, and there are strict
conventions:
Β· postconditions are DECLARATIONS ABOUT THE DOMAIN MODEL
STATE, not actions
Β· they are expressed in the PAST TENSE, as though the
operation has already completed β "a Payment was
created", not "create a Payment"
Β· WHY THE PAST TENSE? Because it forces a statement about
RESULTS rather than a description of an algorithm. The
moment you write "then look up the district and
calculateβ¦" you are designing, which is the next phase's
job.
THE FOUR KINDS OF POSTCONDITION β the checklist to work
through:
1. INSTANCE CREATION or DELETION
2. ATTRIBUTE MODIFICATION
3. ASSOCIATIONS FORMED or BROKEN
4. (and by implication) nothing else changed
WORKED CONTRACT:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
OPERATION recordPayment(applicationNo : String,
amount : Money,
method : PaymentMethod)
CROSS REFERENCES UC-05 Issue a Licence,
UC-07 Renew a Licence
PRECONDITIONS an Application with applicationNo exists;
its status is APPROVED;
no Payment is currently associated with it;
the officer is authenticated and authorised
POSTCONDITIONS
Β· a Payment instance p was created (1)
Β· p.amount became amount (2)
Β· p.method became method (2)
Β· p.receivedOn became the current time (2)
Β· p was associated with the Application (3)
Β· p was associated with the recording Officer (3)
Β· a Receipt instance r was created (1)
Β· r was associated with p (3)
Β· no other Application was modified (4)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
NOTE THE LAST LINE. "No other Application was modified" is the
FRAME CONDITION from the formal-methods topic, and it is the
clause prose specifications always omit. Its absence permits an
implementation that quietly changes something it should not.
NOTE ALSO the precondition "no Payment is currently associated
with it". That is what prevents double payment, and it was
discovered by asking what must be true beforehand β a question
the main scenario never prompts.
WHY CONTRACTS ARE WORTH THE EFFORT: writing one forces you to
walk the domain model and state precisely which instances,
attributes and associations change. That walk regularly reveals
a missing concept or association β the Receipt in the example
above appears because you cannot state the postcondition
without it.
WHEN NOT TO WRITE CONTRACTS: when the operation's effect is
obvious from its name and the use case text. Contracts earn
their cost on operations with complex or subtle state changes,
and are waste on `getApplicationDetails`. Larman's advice is
explicit: use them when the use case text is insufficient.
State machines, and choosing a behavioural view
A STATE MACHINE DIAGRAM shows the lifecycle of ONE object: the
states it can occupy, the events that cause transitions, and any
guards and actions.
WHEN TO DRAW ONE: for a STATE-DEPENDENT object β one that reacts
differently to the same event depending on its current state.
An Application is state-dependent (approving a REJECTED
application must fail); a Payment largely is not.
THE APPLICATION LIFECYCLE, as a state machine:
β
β submit
βΌ
ββββββββββββ assignForReview ββββββββββββββββ
β RECEIVED βββββββββββββββββββββΆβ UNDER_REVIEW β
ββββββββββββ ββββββββ¬ββββ¬ββββ
approve β β reject
[reviewedBy β β
β issuedBy] β β
βββββββββΌβ βΌββββββββββββ
βAPPROVEDβ β REJECTED ββ
βββββ¬βββββ ββββββββββββ
issue β
[feePaid] / β
allocateNumber βΌ
βββββββββββ
β ISSUED ββ
βββββββββββ
NOTATION:
β initial pseudostate β final state
event [guard] / action on a transition
entry / exit actions inside a state
composite states, and history, for nested behaviour
WHAT THE DIAGRAM MAKES UNAVOIDABLE β and this is its value:
Β· WHICH TRANSITIONS ARE LEGAL, exhaustively. Every pair not
drawn is illegal, so the diagram is a complete statement.
This is the state machine that the interface
specification topic discovered by asking about HTTP 409,
and that the formal-methods topic needed to write the
precondition.
Β· GUARDS as business rules: `[feePaid]` and
`[reviewedBy β issuedBy]` are visible constraints.
Β· TERMINAL STATES: REJECTED and ISSUED are final, which
raises the reversal question from the change-management
topic β CR-227 was precisely a request to make ISSUED
non-terminal, and this diagram is what shows the size of
that request.
Β· TESTING IMPLICATIONS: from the test case design topic,
state transition testing requires exercising every valid
transition AND representative invalid ones. Counting the
arrows gives you a test count: 5 valid transitions here,
plus the invalid combinations worth probing.
CHOOSING A BEHAVIOURAL VIEW β the practical summary of this whole
topic:
QUESTION DIAGRAM / ARTEFACT
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
What crosses the system SYSTEM SEQUENCE DIAGRAM
boundary, in what order?
What exactly changes when OPERATION CONTRACT
this operation runs?
What states can this object STATE MACHINE
be in, and what is legal?
What is the flow of this ACTIVITY DIAGRAM
process, including parallel
branches?
Which internal objects (design) SEQUENCE or
collaborate to achieve this? COMMUNICATION DIAGRAM
THE LAST ROW IS THE BOUNDARY OF THIS SECTION. Everything above
it is ANALYSIS β the system as a black box, described by what
it must do. The last row opens the box and assigns
responsibilities to internal objects, which is design, and the
subject of ACtE0805.
THE ONE-LINE SUMMARY OF THE DISCIPLINE: an SSD says WHAT
operations exist, a contract says WHAT each one changes, a state
machine says WHEN each is legal β and none of them says HOW.
Keeping the "how" out until all three are answered is what
makes the design that follows a solution to a properly
understood problem.
The past-tense convention for postconditions is a small rule with a large effect. Writing "a Payment was created" instead of "create a Payment" makes it impossible to slide into describing an algorithm β the grammar itself keeps you specifying results rather than designing a solution, which is precisely the discipline analysis requires.
π Go further: operation contracts have a directly executable descendant in design by contract β preconditions, postconditions and invariants written as assertions the runtime checks. Eiffel built it into the language; modern equivalents range from plain assert statements to property-based tests that verify postconditions across generated inputs. The interesting property is that a contract written during analysis can become the test written during implementation without being rewritten, which closes the same drift gap that specification-by-example closes for use cases. Search "design by contract preconditions postconditions Eiffel".
π‘ Exam angle: describe a system sequence diagram, stressing that the system appears as a single black box and that its purpose is to identify the system operations. Be ready to draw one for a given scenario. Write an operation contract with the template β operation, cross references, preconditions, postconditions β and observe the conventions: postconditions are declarations about domain-model state, in the past tense, covering instance creation/deletion, attribute modification and associations formed/broken. Draw a state machine diagram with events, guards and actions, and explain that undrawn transitions are illegal and that guards express business rules.
Syllabus points
Sequence & state diagrams
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Related topics in Object-Oriented Fundamentals and Analysis