Ch05.5 System Architecture Design
Ch05.5 System Architecture Design
Code
One answer
Requirements
a miracle happens
Code
A better answer
Requirements
Provides a high-level
framework to
Software Architecture build and evolve the
system
Code
What does an architecture look like?
Box-and-arrow diagrams
10
Divide and conquer
• Benefits of decomposition:
– Decrease size of tasks
– Support independent testing and analysis
– Separate work assignments
– Ease understanding
• Use of abstraction leads to modularity
– Implementation techniques: information hiding,
interfaces
• To achieve modularity, you need:
– Strong cohesion within a component
– Loose coupling between components
– And these properties should be true at each level
An architecture helps with
System understanding: interactions between
modules
Reuse: high-level view shows opportunity for reuse
Construction: breaks development down into work
items; provides a path from requirements to code
Evolution: high-level view shows evolution path
Management: helps understand work items and
track progress
Communication: provides vocabulary; a picture
says 1000 words
Qualities of modular software
• decomposable
– can be broken down into pieces
• composable
– pieces are useful and can be combined
• understandable
– one piece can be examined in isolation
• has continuity
– change in reqs affects few modules
• protected / safe
– an error affects few other modules
Interface and implementation
• public interface: data and behavior of the object that
can be seen and executed externally by "client" code
• private implementation: internal data and methods in
the object, used to help implement the public
interface, but cannot be directly accessed
• client: code that uses your class/subsystem
Example: radio
– public interface is the speaker, volume buttons, station dial
– private implementation is the guts of the radio; the
transistors, capacitors, voltage readings, frequencies, etc.
that user should not see
14
Properties of architecture
• Coupling
• Cohesion
• Style conformity
• Matching
• Errosion
Loose coupling
• Coupling: the kind and quantity of
interconnections among modules
• No schizophrenic classes!
Strong or weak cohesion?
class Employee {
public:
5
FullName GetName() const;
Address GetAddress() const;
PhoneNumber GetWorkPhone() const;
5
bool IsJobClassificationValid(JobClassification jobClass);
bool IsZipCodeValid (Address address);
bool IsPhoneNumberValid (PhoneNumber phoneNumber);
5
SqlQuery GetQueryToCreateNewEmployee() const;
SqlQuery GetQueryToModifyEmployee() const;
SqlQuery GetQueryToRetrieveEmployee() const;
5
}
Architectural style
• Defines the vocabulary of components and connectors
for a family (style)
• Constraints on the elements and their combination
– Topological constraints (no cycles, register/announce
relationships, etc.)
– Execution constraints (timing, etc.)
• By choosing a style, one gets all the known properties
of that style (for any architecture in that style)
– Ex: performance, lack of deadlock, ease of making
particular classes of changes, etc.
Styles are not just boxes and arrows
• Consider pipes & filters, for example (Garlan and Shaw)
– Pipes must compute local transformations
– Filters must not share state with other filters
– There must be no cycles
• If these constraints are violated, it’s not a pipe & filter system
– One can’t tell this from a picture
– One can formalize these constraints
Performance
Installation
(execution)
Requirements
Requirements
Booch
Web application (client-server)
Booch
Model-View-Controller
User
Separates:
sees uses
• the application object
(model)
View Controller
• the way it is
represented to the user
updates manipulates
(view)
Model
• the way in which the
user controls it
Application (controller).
Pipe and filter
Pipe – passes the data
32