Software Engineering & Object-Oriented Analysis & Design β Object-Oriented Fundamentals and Analysis, NEC licence examination syllabus (Nepal Engineering Council).
Defining Models
Why we draw pictures of software instead of just writing it.
π Where this lives: before a building is constructed, someone draws it β not because drawing is fun, but because moving a wall on paper costs a pencil stroke and moving it in concrete costs a demolition crew. Software models exist for exactly that reason, with one important difference: software is invisible, so without a model there is nothing at all to look at until the code exists. A model is the only way to have a conversation about a system that has not been built yet. Search "why model software abstraction communication".
What a model is and what it is for
A MODEL is a SIMPLIFIED REPRESENTATION of reality, created to
help us understand, communicate about, or predict the behaviour of
something complex.
THE DEFINING PROPERTY IS OMISSION. A model that included
everything would be as complex as the thing itself and
therefore useless. A map of a city that showed every brick
would be the size of the city. THE VALUE OF A MODEL IS IN WHAT
IT LEAVES OUT, and choosing what to omit is the modelling
skill.
WHY WE MODEL SOFTWARE β four reasons:
1. TO MANAGE COMPLEXITY. Humans reason about roughly seven
things at once; a system has thousands. A model presents
one manageable view.
2. TO COMMUNICATE. A model is a shared artefact that
developers, analysts and customers can all point at. Code
cannot serve this role because most stakeholders cannot
read it.
3. TO REASON BEFORE BUILDING. You can find a flaw in a model
for the cost of a discussion; the same flaw in code costs
a rewrite β the cost-of-change curve from the design unit.
4. TO CAPTURE DECISIONS. A model records what was decided and
often why, which is what a maintainer needs years later.
THE FUNDAMENTAL PRINCIPLES OF MODELLING (Booch, Rumbaugh,
Jacobson):
Β· the choice of what models to create has a profound
influence on how a problem is attacked and how a solution
is shaped
Β· every model may be expressed at different levels of
precision
Β· the best models are CONNECTED TO REALITY
Β· no single model is sufficient β every non-trivial system
is best approached through a small set of nearly
independent models
THAT LAST PRINCIPLE IS THE 4+1 INSIGHT from the design model
topic: several views, and scenarios to tie them together.
A MODEL vs A DIAGRAM β a distinction students often miss:
the MODEL is the underlying set of elements and their
relationships β the semantic content
a DIAGRAM is one VIEW of part of that model, a projection
Several diagrams can show the same model from different
angles, and a change to the model should be reflected in
every diagram that shows the affected elements. This is why
modelling tools maintain a repository rather than a folder of
pictures, and why hand-drawn diagrams drift out of
consistency with each other.
Analysis versus design models
THE TWO MODELS THAT MATTER MOST IN OBJECT-ORIENTED WORK, and the
line between them:
THE ANALYSIS MODEL β "WHAT"
Describes the PROBLEM DOMAIN. It is written in the vocabulary
of the users and the business, and deliberately contains NO
implementation decisions.
Β· classes correspond to real-world concepts: Applicant,
Licence, Payment, Officer
Β· attributes are named but often untyped
Β· no visibility markers, no technical infrastructure
Β· the question it answers: what things exist in this
business, and how do they relate?
ALSO CALLED the conceptual model, the domain model, or the
essential model.
THE DESIGN MODEL β "HOW"
Describes the SOLUTION. It adds everything needed to
implement:
Β· types, visibility, multiplicities, exceptions
Β· solution-domain classes with no business counterpart:
controllers, repositories, factories, caches
Β· solution-domain attributes: the `version` field for
optimistic locking from the design model topic
Β· the technical layers: user interface, persistence,
infrastructure
THE TEST FOR WHICH SIDE SOMETHING BELONGS ON: could you
explain this element to a licence officer in their own
vocabulary? "Applicant" yes; "ApplicationRepository" no. The
first is analysis, the second is design.
WHY KEEP THEM SEPARATE?
Β· the analysis model can be VALIDATED BY THE CUSTOMER, who
can confirm "yes, an application does have exactly one
applicant" β they cannot validate a repository pattern
Β· the analysis model OUTLIVES the design. The business
concept of a licence application will still be true after
three technology migrations, so the analysis model is the
stable, reusable asset.
Β· mixing them means implementation decisions get made during
analysis, before enough is known β and get frozen because
they are embedded in the agreed document
THE COMMON FAILURE: an "analysis model" full of technical
classes, produced by developers thinking about implementation.
The symptom is a diagram the customer cannot read, which means
the validation step is impossible and the model's main purpose
has been lost.
THE THREE MODELLING PERSPECTIVES (Steve Cook and John Daniels),
useful for knowing what a diagram is claiming:
CONCEPTUAL describes the domain concepts themselves,
independent of any software
SPECIFICATION describes the interfaces of the software,
not the implementation
IMPLEMENTATION describes the classes as they will be coded
The SAME class diagram notation is used for all three, which
is a genuine source of confusion β a reader must know which
perspective is intended. Label your diagrams.
How much to model β and the failure modes
MODELLING HAS A COST, and the honest question is how much is
worth paying.
A WORKED JUDGEMENT β four situations, same team:
(a) A 3-CLASS UTILITY, one developer, two days' work.
Modelling cost: 2 hours to draw and review.
Benefit: essentially none. Three classes fit in one head.
VERDICT: don't model. Write the code.
(b) A 40-CLASS SUBSYSTEM, four developers, three months.
Modelling cost: ~3 days of design work and review.
Benefit: the four developers can work in parallel because
the class boundaries and interfaces are agreed. Without
the model they must either work sequentially or
continually renegotiate interfaces.
QUANTIFY IT: if a missing interface agreement causes each
developer 2 hours of rework per week over 12 weeks:
4 developers Γ 2 h Γ 12 weeks = 96 hours = 12 days
against 3 days of modelling. A 4Γ return, and that
excludes the integration failures.
VERDICT: model the class structure and the interfaces.
(c) A DOMAIN NOBODY ON THE TEAM UNDERSTANDS β insurance
underwriting, say.
Benefit: the model is the vehicle for LEARNING the domain
and for having the domain expert correct you. Here the
model's value is the CONVERSATION it enables, not the
diagram it produces.
VERDICT: model, and expect to redraw it three times. The
redrawing is the work, not waste.
(d) A SYSTEM THAT WILL BE MAINTAINED FOR 15 YEARS BY PEOPLE NOT
YET HIRED.
Benefit: the model is the only orientation a newcomer will
have. Code tells you what happens; a model tells you what
the parts are and why.
VERDICT: model, and β critically β KEEP IT CURRENT or
delete it.
THE PRINCIPLE ACROSS ALL FOUR: MODEL WHERE THERE IS SOMETHING
TO DECIDE OR SOMETHING TO AGREE. Model to think, model to
communicate, model to remember. Do not model to satisfy a
process.
THE FAILURE MODES:
THE MODEL THAT DRIFTS
The diagram says one thing and the code says another. A
stale model is WORSE THAN NO MODEL, because a reader trusts
it and is misled. The two honest options are to keep it
current or to delete it β and deleting an obsolete diagram is
a genuine improvement, not a loss.
ANALYSIS PARALYSIS
Modelling continues because it is comfortable and produces
visible artefacts, while no code exists and no feedback has
been obtained. The diagnostic: has the model changed anything
about what we will build? If several days of modelling have
produced no decision, stop and build something.
MODELLING EVERYTHING AT UNIFORM DETAIL
A 200-class diagram covering an entire system is unreadable
and therefore communicates nothing. Model the hard parts in
detail and the easy parts not at all β the same
risk-proportionate principle as the SQA plan.
THE DIAGRAM AS DOCUMENTATION SUBSTITUTE
A class diagram shows structure and cannot express WHY a
structure was chosen. The rationale β the alternatives
rejected and the reasons β is prose, and it is the part
maintainers most need. A folder of diagrams with no
explanatory text is a common and frustrating handover.
THE TEST OF A GOOD MODEL, in one question: DOES SOMEONE MAKE A
DIFFERENT DECISION BECAUSE OF IT? If yes, it earned its cost.
If it merely restates what the code already says, it is
documentation debt that will drift and mislead.
The most useful thing to carry from this topic: a stale model is worse than no model. A missing diagram costs a reader some exploration; a wrong diagram costs them a false belief they will act on. Deleting an obsolete model is therefore an improvement, which is not how most teams treat documentation.
π Go further: the modern answer to model drift is to stop maintaining diagrams by hand. Diagrams as code β PlantUML, Mermaid, Structurizr β puts the model in a text file beside the source, so it is version-controlled, reviewable in a diff, and regenerable in CI. The C4 model adds the missing discipline of zoom levels: Context, Container, Component, Code, each a separate diagram with its own audience, so you never draw the 200-class picture that communicates nothing. Together they turn a model from an artefact that decays into one that is maintained like code. Search "C4 model diagrams as code Structurizr".
π‘ Exam angle: define a model and state why we model software β managing complexity, communication, reasoning before building, capturing decisions. Give the four principles of modelling (the choice of model shapes the solution; models can be at different precisions; the best models are connected to reality; no single model suffices). Distinguish a model from a diagram, and β most importantly β distinguish the analysis model (problem domain, users' vocabulary, customer-validatable) from the design model (solution domain, implementation detail, solution-only classes). Know the three perspectives: conceptual, specification, implementation.
Syllabus points
Purpose and types of models
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