Three ways to arrange the top-level boxes: share data, layer it, or store it centrally.
π Where this lives: you have used all three today. A compiler passing an abstract syntax tree between phases is a repository model. The TCP/IP stack in your machine is a layered model. Your web browser talking to a server is client-server. These are not competing fashions β they are three different answers to the question "where does the shared state live?", and the answer determines everything downstream about scalability, coupling and who can change what. Search "architectural styles repository layered client server comparison".
The repository (shared data) model
SYSTEM ORGANISATION reflects the basic strategy used to
structure a system. Three organisational styles are widely used.
THE REPOSITORY MODEL
Subsystems must exchange data. This may be done in two ways:
(a) all shared data is held in a CENTRAL DATABASE or
REPOSITORY, accessible to all subsystems β the
repository model
(b) each subsystem maintains its own database, and data is
passed explicitly between subsystems
When large amounts of data are to be shared, the repository
model is most commonly used, because it is an efficient way of
sharing large volumes of data β there is no need to transmit
data explicitly from one subsystem to another.
ADVANTAGES
Β· EFFICIENT for sharing large amounts of data β no
transmission needed
Β· subsystems producing data NEED NOT KNOW how that data is
used by other subsystems
Β· CENTRALISED MANAGEMENT β backup, security, access control
and recovery are handled in one place; new tools are easy
to integrate if they are compatible with the agreed data
model
Β· SHARING MODEL IS PUBLISHED as the repository schema, so
integrating new tools is straightforward
DISADVANTAGES
Β· subsystems must AGREE ON A DATA MODEL β inevitably a
compromise, and the compromise may make each subsystem's
job harder
Β· EVOLUTION IS DIFFICULT β a new data model means converting
the whole repository, at high cost
Β· different subsystems have different requirements for
security, recovery and backup policy, but the repository
model forces the SAME POLICY on all
Β· DISTRIBUTION IS HARD β even where logically possible,
keeping a distributed repository consistent is expensive
CLASSIC EXAMPLES: a CASE toolset sharing a design repository;
a compiler whose phases share a symbol table and AST; a
database-centred enterprise application; a blackboard system
in AI.
THE ONE-LINE SUMMARY: the repository model trades COUPLING FOR
CONVENIENCE. Everything is easy to reach, and everything
therefore depends on one schema β which is why "the shared
database" is the hardest architectural decision to reverse.
The clientβserver model and the layered model
THE CLIENTβSERVER MODEL
A distributed system model showing how data and processing are
distributed across a range of components. It has three parts:
Β· a set of STAND-ALONE SERVERS offering services (a print
server, a file server, a name server)
Β· a set of CLIENTS that call on these services
Β· a NETWORK allowing clients to access servers
Clients may have to know the names of the available servers and
the services they provide; servers need not know the identity
of clients or how many there are. Clients access services
provided by a server through REMOTE PROCEDURE CALLS.
ADVANTAGES
Β· DISTRIBUTION OF DATA IS STRAIGHTFORWARD
Β· makes EFFECTIVE USE of networked systems; may allow
cheaper hardware
Β· EASY TO ADD a new server or upgrade an existing one
transparently
DISADVANTAGES
Β· NO SHARED DATA MODEL, so subsystems use different data
organisation, and data interchange may be inefficient
Β· REDUNDANT MANAGEMENT in each server
Β· NO CENTRAL REGISTER of names and services β it may be hard
to find out what services and servers are available
THE LAYERED (ABSTRACT MACHINE) MODEL
Used to model the interfacing of subsystems. Organises the
system into a set of layers (or abstract machines), each
providing a set of services.
Β· supports the INCREMENTAL DEVELOPMENT of subsystems in
different layers β when a layer interface changes, only
the adjacent layer is affected
Β· CHANGEABLE and PORTABLE β the layered structure means each
layer can be replaced by an equivalent one without
affecting the rest, provided the interface holds
DISADVANTAGE
Β· STRUCTURING THE SYSTEM IN LAYERS CAN BE DIFFICULT. An
inner layer may provide facilities required by an outer
layer that is not immediately adjacent, forcing either a
layer-skipping call (breaking the model) or a pass-through
(adding no value).
Β· PERFORMANCE can suffer: a service request may have to be
interpreted at each layer, so multiple levels of
interpretation add latency. This is the cost the layered
model pays for its portability.
THE STRICT vs RELAXED LAYERING QUESTION:
STRICT a layer may call ONLY the layer immediately below.
Maximum isolation, maximum pass-through
boilerplate.
RELAXED a layer may call ANY lower layer. Less
boilerplate, but now a change to layer 1 can
affect layer 4 directly, which is the property
layering was bought to prevent.
Real systems mostly use relaxed layering and then regret it
selectively.
CLASSIC EXAMPLES: the OSI/TCP-IP protocol stack; an operating
system (hardware β kernel β system calls β libraries β
applications); a version-management system layered over an
object-management system over a database system over an
operating system.
Comparing the three on one system
THE SAME requirement β "the licence system must produce monthly
revenue reports" β organised three ways.
REPOSITORY
ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ
β Intake β Review β Payment β Reportingβ
ββββββ¬ββββββ΄βββββ¬ββββββ΄βββββ¬ββββββ΄βββββ¬ββββββ
ββββββββββββ΄βββββ¬ββββββ΄βββββββββββ
ββββββββΌβββββββ
β REPOSITORY β one schema
βββββββββββββββ
Reporting simply queries the shared tables. Adding a report
costs a SELECT and nothing else β the model's great strength.
BUT: Payment cannot change its fee table shape without
breaking Reporting, and nobody knows who reads what, so in
practice NOTHING can be changed safely. Evolution cost is the
price of the query convenience.
LAYERED
ββββββββββββββββββββββββββββββββββ presentation
ββββββββββββββββββββββββββββββββββ€ application services
ββββββββββββββββββββββββββββββββββ€ domain logic
ββββββββββββββββββββββββββββββββββ€ data access
ββββββββββββββββββββββββββββββββββ database
Reporting is a domain service; presentation never touches SQL.
Swapping PostgreSQL for another store means rewriting ONE
layer. BUT: a report needing a bulk aggregate must either go
through the per-entity data-access layer (slow β the N+1
query problem) or skip a layer (breaking the model). This is
the layering pain in its most common real form.
CLIENTβSERVER
Intake service Review service Payment service
β β β
βββββββββββββββββββ΄ββββββββββββββββββ
network
β
Reporting client
Each service owns its data and exposes an API. Payment can
change its internals freely. BUT: a revenue report now needs
data from three services, so Reporting must make three network
calls and JOIN IN APPLICATION CODE β and if Payment is down,
the report fails. There is no consistent point-in-time
snapshot across three independent stores.
THE HONEST SCORECARD
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
criterion repository layered clientβserver
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ad-hoc reporting excellent good poor
independent change poor good excellent
scaling out poor moderate excellent
consistency excellent excellent poor
operational effort low low high
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
NOTE THE PATTERN: reporting ease and independent change are
ANTI-CORRELATED across all three rows. That is not a
coincidence β easy cross-cutting queries require shared
structure, and shared structure is exactly what prevents
independent change. Every "which architecture?" argument in
industry is a rediscovery of this one trade-off.
The layer-skipping problem in the worked example is worth internalising, because it is the most common way a layered design decays in practice. A bulk report needs an aggregate query; going through the per-entity data-access layer is too slow; so somebody adds one direct SQL call from the service layer β and once one exists, the layering is advisory rather than structural.
π Go further: the reporting-versus-independence trade-off in the scorecard has an industry-standard resolution: CQRS (Command Query Responsibility Segregation) plus a read model. Services keep their own stores for writes β preserving independent change β and publish events to a separate, denormalised read store built purely for queries and reporting. You get both properties by duplicating the data, paying for it in eventual consistency: the report may lag the truth by seconds. That is often an entirely acceptable price, and recognising when it is not is the actual skill. Search "CQRS read model eventual consistency reporting".
π‘ Exam angle: describe all three organisational models β repository (shared data), clientβserver, layered (abstract machine) β with a diagram and the advantages and disadvantages of each. This is one of the most reliably asked questions in the design unit, and the marks are in the disadvantage lists: for repository, the forced common data model, difficult evolution and uniform policy; for clientβserver, no shared data model and no central service register; for layered, the difficulty of clean layering and the performance cost of multi-level interpretation.
Syllabus points
Organizing the system structure
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.