Software Architecture
Software Architecture
– Reusability: Restrict inter-element coupling, so that when you extract an element, it does not come
out with too many attachments to its current environment.
– Will the software be layered? If so, how many layers will there be? What will each one do?
– Will components communicate synchronously or asynchronously? Will they interact by transferring
control or data or both?
– Will the system depend on specific features of the operating system or hardware?
– Will the information that flows through the system be encrypted or not?
– What communication protocol will we choose?
• Imagine the nightmare of having to change any of these decisions.
– Greater interoperability.
• Architectural patterns guide the architect and focus the architect on the quality attributes of interest in large
part by restricting the vocabulary of design.
– Properties of software design follow from the choice of an architectural pattern.
Summary
1. An architecture will inhibit or enable a system’s driving quality attributes.
2. The decisions made in an architecture allow you to reason about and manage change as the system
evolves.
3. The analysis of an architecture enables early prediction of a system’s qualities.
4. A documented architecture enhances communication among stakeholders.
5. The architecture is a carrier of the earliest and hence most fundamental, hardest-to-change design
decisions.
6. An architecture defines a set of constraints on subsequent implementation.
7. The architecture dictates the structure of an organization, or vice versa.
8. An architecture can provide the basis for evolutionary prototyping.
9. An architecture is the key artifact that allows the architect and project manager to reason about cost and
schedule.
10. An architecture can be created as a transferable, reusable model that form the heart of a product line.
11. Architecture-based development focuses attention on the assembly of components, rather than simply on
their creation.
12. By restricting design alternatives, architecture channels the creativity of developers, reducing design and
system complexity.
13. An architecture can be the foundation for training a new team member.
– Technical. What technical role does the software architecture play in the system or systems of
which it’s a part?
– Project life cycle. How does a software architecture relate to the other phases of a software
development life cycle?
– Business. How does the presence of a software architecture affect an organization’s business
environment?
– Professional. What is the role of a software architect in an organization or a development project?
Technical Context
• The most important technical context factor is the set of quality attributes that the architecture can help to
achieve.
• The architecture’s current technical environment is also an important factor.
– Standard industry practices
– Software engineering techniques prevalent in the architect’s professional community.
• Today’s information systems are web-based, object-oriented, service-oriented, mobility-aware, cloud-based,
social-networking-friendly.
– It wasn’t always so.
– It won’t be so ten years from now.
Architecture Activities
• All of these processes include design among their obligations.
• Architecture is a special kind of design, so architecture finds a home in each one.
• No matter the software development process, there are activities involved in creating a software
architecture, using that architecture to realize a complete design, and then implementing or managing the
evolution of a target system or application:
– 1. Making a business case for the system
– 2. Understanding the architecturally significant requirements
– 3. Creating or selecting the architecture
– 4. Documenting and communicating the architecture
– 5. Analyzing or evaluating the architecture
– 6. Implementing and testing the system based on the architecture
– 7. Ensuring that the implementation conforms to the architecture
Business Context
Architectures and systems are not constructed frivolously.
They serve some business purposes.
These purposes may change over time.
• Systems are created to satisfy the business goals of one or more organizations.
– Development organizations want to make a profit, or capture market, or stay in business, or help
their customers do their jobs better, or keep their staff gainfully employed, or make their
stockholders happy, or a little bit of each.
– Customers have their own goals for acquiring a system, usually involving some aspect of making
their lives easier or more productive. Other organizations involved in a project’s life cycle, such as
subcontractors or government regulatory agencies, have their own goals dealing with the system.
• Architects need to understand who the vested organizations are and what their goals are. Many of these
goals will have a profound influence on the architecture.
Professional Context
You will perform many duties beyond directly producing an architecture.
– You will need to be involved in supporting management and dealing with customers.
Architects need more than just technical skills.
– Architects need to explain to one stakeholder or another the chosen priorities of different
properties, and why particular stakeholders are not having all of their expectations fulfilled.
– Architects need diplomatic, negotiation, and communication skills.
– Architects need the ability to communicate ideas clearly
– You will need to manage a diverse workload and be able to switch contexts frequently.
8|Page Software Architecture
Stakeholders
• A stakeholder is anyone who has a stake in the success of the system
• Stakeholders typically have different specific concerns that they wish the system to guarantee or optimize.
• You will need to know and understand the nature, source, and priority of constraints on the project as early
as possible. Therefore, you must identify and actively engage the stakeholders to solicit their needs and
expectations.
• Early engagement of stakeholders allows you to understand the constraints of the task, manage
expectations, negotiate priorities, and make tradeoffs.
• Know your stakeholders!
• Talk to them, engage them, listen to them, and put yourself in their shoes.
• See Table for a list of example stakeholders and their interests and concerns.
Technical context
– The architecture can affect stakeholder requirements for the next system
– It gives the customer the opportunity to receive a system (based on the same architecture) in a
more reliable, timely, and economical manner than if built from scratch.
– A customer may in fact be willing to relax some of their requirements to gain these economies.
– Shrinkwrapped software has clearly affected people’s requirements by providing solutions that are
not tailored to any individual’s precise needs but are instead inexpensive and (in the best of all
possible worlds) of high quality.
Project context
– The architecture affects the structure of the developing organization.
– An architecture prescribes the units of software that must be implemented (or otherwise obtained)
and integrated to form the system.
– These units are the basis for the development project’s structure.
– Teams are formed for individual software units; and the development, test, and integration activities
all revolve around the units.
– Teams become embedded in the organization’s structure.
Business context
– The architecture can affect the business goals of the developing organization.
– A successful system built from an architecture can enable a company to establish a foothold in a
particular market segment.
– The architecture can provide opportunities for the efficient production and deployment of similar
systems, and the organization may adjust its goals to take advantage of its newfound expertise to
plumb the market.
Professional context
– The process of system building will affect the architect’s experience with subsequent.
– A system that was successfully built around a particular technical approach will make the architect
more inclined to build systems using the same approach in the future.
– Architectures that fail are less likely to be chosen for future projects.
10 | P a g e Software Architecture
Summary
• Architectures exist in four different contexts.
– Technical. The technical context includes the achievement of quality attribute requirements.
– Project life cycle. Regardless of the software development methodology you use, you must
perform specific activities.
– Business. The system created from the architecture must satisfy the business goals of a wide
variety of stakeholders.
– Professional. You must have certain skills and knowledge to be an architect, and there are certain
duties that you must perform as an architect.
• An architecture has influences that lead to its creation, and its existence has an impact on the architect, the
organization, and, potentially, the industry.
• We call this cycle the Architecture Influence Cycle.
Structures, on the other hand, are fairly easy to identify in software, and they form a powerful tool for system design.
Module Structures
• Some structures partition systems into implementation units, which we call modules.
• Modules are assigned specific computational responsibilities, and are the basis of work assignments for
programming teams.
• In large projects, these elements (modules) are subdivided for assignment to sub-teams.
Component-and-connector Structures
• Other structures focus on the way the elements interact with each other at runtime to carry out the system’s
functions.
• We call runtime structures component-and-connector (C&C) structures.
• In our use, a component is always a runtime entity.
– Suppose the system is to be built as a set of services.
– The services, the infrastructure they interact with, and the synchronization and interaction relations
among them form another kind of structure often used to describe a system.
– These services are made up of (compiled from) the programs in the various implementation units –
modules.
Allocation Structures
Allocation structures describe the mapping from software structures to the system’s environments
– organizational
– developmental
– installation
– Execution
For example
– Modules are assigned to teams to develop, and assigned to places in a file structure for
implementation, integration, and testing.
– Components are deployed onto hardware in order to execute.
Architecture is an Abstraction
• An architecture comprises software elements and how the elements relate to each other.
– An architecture specifically omits certain information about elements that is not useful for reasoning
about the system.
– It omits information that has no ramifications outside of a single element.
– An architecture selects certain details and suppresses others.
– Private details of elements—details having to do solely with internal implementation—are not
architectural.
• The architectural abstraction lets us look at the system in terms of its elements, how they are arranged, how
they interact, how they are composed, what their properties are that support our system reasoning, and so
forth.
• This abstraction is essential to taming the complexity of an architecture.
• We simply cannot, and do not want to, deal with all of the complexity all of the time.
Physiological Structures
• The neurologist, the orthopedist, the hematologist, and the dermatologist all have different views of the
structure of a human body.
• Ophthalmologists, cardiologists, and podiatrists concentrate on specific subsystems.
• The kinesiologist and psychiatrist are concerned with different aspects of the entire arrangement’s behavior.
• Although these views are pictured differently and have different properties, all are inherently related,
interconnected.
• Together they describe the architecture of the human body.
• So it is with software!
13 | P a g e Software Architecture
Physiological Structures
Module Structures
• Module structures embody decisions as to how the system is to be structured as a set of code or data units
that have to be constructed or procured.
• In any module structure, the elements are modules of some kind (perhaps classes, or layers, or merely
divisions of functionality, all of which are units of implementation).
• Modules are assigned areas of functional responsibility; there is less emphasis in these structures on how
the software manifests at runtime.
• Module structures allow us to answer questions such as these:
– What is the primary functional responsibility assigned to each module?
– What other software elements is a module allowed to use?
– What other software does it actually use and depend on?
– What modules are related to other modules by generalization or specialization (i.e., inheritance)
relationships?
Component-and-connector Structures
• Component-and-connector structures embody decisions as to how the system is to be structured as a set of
elements that have runtime behavior (components) and interactions (connectors).
• Elements are runtime comopnents such as services, peers, clients, servers, filters, or many other types of
runtime element)
• Connectors are the communication vehicles among components, such as call-return, process
synchronization operators, pipes, or others.
• Component-and-connector views help us answer questions such as these:
– What are the major executing components and how do they interact at runtime?
14 | P a g e Software Architecture
Allocation structures
• Allocation structures show the relationship between the software elements and elements in one or more
external environments in which the software is created and executed.
• Allocation views help us answer questions such as these:
– What processor does each software element execute on?
– In what directories or files is each element stored during development, testing, and system
building?
– What is the assignment of each software element to development teams?
Uses structure.
• The units here are also modules, perhaps classes.
• The units are related by the uses relation, a specialized form of dependency.
• A unit of software uses another if the correctness of the first requires the presence of a correctly functioning
version (as opposed to a stub) of the second.
• The uses structure is used to engineer systems that can be extended to add functionality, or from which
useful functional subsets can be extracted.
• The ability to easily create a subset of a system allows for incremental development.
15 | P a g e Software Architecture
Layer structure
• The modules in this structure are called layers.
• A layer is an abstract “virtual machine” that provides a cohesive set of services through a managed
interface.
• Layers are allowed to use other layers in a strictly managed fashion.
– In strictly layered systems, a layer is only allowed to use a single other layer.
• This structure is imbues a system with portability, the ability to change the underlying computing platform.
Data model
• The data model describes the static information structure in terms of data entities and their relationships.
– For example, in a banking system, entities will typically include Account, Customer, and Loan.
– Account has several attributes, such as account number, type (savings or checking), status, and
current balance.
• Relations are allocated-to, showing on which physical units the software elements reside, and migrates-to if
the allocation is dynamic.
• This structure can be used to reason about performance, data integrity, security, and availability.
• It is of particular interest in distributed and parallel systems.
Implementation structure
• This structure shows how software elements (usually modules) are mapped to the file structure(s) in the
system’s development, integration, or configuration control environments.
• This is critical for the management of development activities and build processes.
Architectural Patterns
• Architectural elements can be composed in ways that solve particular problems.
– The compositions have been found useful over time, and over many different domains
– They have been documented and disseminated.
– These compositions of architectural elements, called architectural patterns.
– Patterns provide packaged strategies for solving some of the problems facing a system.
• An architectural pattern delineates the element types and their forms of interaction used in solving the
problem.
• A common module type pattern is the Layered pattern.
17 | P a g e Software Architecture
– When the uses relation among software elements is strictly unidirectional, a system of layers
emerges.
– A layer is a coherent set of related functionality.
– Many variations of this pattern, lessening the structural restriction, occur in practice.
• The architecture should feature well-defined modules whose functional responsibilities are assigned on the
principles of information hiding and separation of concerns.
– The information-hiding modules should encapsulate things likely to change
– Each module should have a well-defined interface that encapsulates or “hides” the changeable
aspects from other software
• Unless your requirements are unprecedented your quality attributes should be achieved using well-known
architectural patterns and tactics specific to each attribute.
• The architecture should never depend on a particular version of a commercial product or tool. If it must, it
should be structured so that changing to a different version is straightforward and inexpensive.
• Modules that produce data should be separate from modules that consume data.
– This tends to increase modifiability
– Changes are frequently confined to either the production or the consumption side of data.
• Don’t expect a one-to-one correspondence between modules and components.
• Every process should be written so that its assignment to a specific processor can be easily changed,
perhaps even at runtime.
• The architecture should feature a small number of ways for components to interact.
– The system should do the same things in the same way throughout.
– This will aid in understandability, reduce development time, increase reliability, and enhance
modifiability.
• The architecture should contain a specific (and small) set of resource contention areas, the resolution of
which is clearly specified and maintained.
Summary
• The software architecture of a system is the set of structures needed to reason about the system, which
comprise software elements, relations among them, and properties of both.
• A structure is a set of elements and the relations among them.
• A view is a representation of a coherent set of architectural elements. A view is a representation of one or
more structures.
• There are three categories of structures:
• Module structures show how a system is to be structured as a set of code or data units that have
to be constructed or procured.
• Component-and-connector structures show how the system is to be structured as a set of elements
that have runtime behavior (components) and interactions (connectors).
• Allocation structures show how the system will relate to nonsoftware structures in its environment
(such as CPUs, file systems, networks, development teams, etc.).
• Structures represent the primary engineering leverage points of an architecture.
• Every system has a software architecture, but this architecture may be documented and disseminated, or it
may not be.
• There is no such thing as an inherently good or bad architecture. Architectures are either more or less fit for
some purpose.
19 | P a g e Software Architecture
Architectural Description
20 | P a g e Software Architecture
Functionality
• Functionality is the ability of the system to do the work for which it was intended.
• Functionality has a strange relationship to architecture:
– functionality does not determine architecture; given a set of required functionality, there is no end to
the architectures you could create to satisfy that functionality
– functionality and quality attributes are orthogonal
• A solution to the first two of these problems (untestable definitions and overlapping concerns) is to use
quality attribute scenarios as a means of characterizing quality attributes.
• A solution to the third problem is to provide a discussion of each attribute—concentrating on its underlying
concerns—to illustrate the concepts that are fundamental to that attribute community.
21 | P a g e Software Architecture
• We distinguish general quality attribute scenarios ( “general scenarios”)—those that are system independent
and can, potentially, pertain to any system—from concrete quality attribute scenarios (concrete scenarios)—
those that are specific to the particular system under consideration.
2. If no pattern exists to realize the architect’s design goal, tactics allow the architect to construct a
design fragment from “first principles”.
3. By cataloguing tactics, we make design more systematic. You frequently will have a choice of
multiple tactics to improve a particular quality attribute. The choice of which tactic to use depends
on factors such as tradeoffs among other quality attributes and the cost to implement.
Allocation of Responsibilities
Decisions involving allocation of responsibilities include:
– identifying the important responsibilities including basic system functions, architectural
infrastructure, and satisfaction of quality attributes.
– determining how these responsibilities are allocated to non-runtime and runtime elements (namely,
modules, components, and connectors).
Coordination Model
Decisions about the coordination model include:
– identify the elements of the system that must coordinate, or are prohibited from coordinating
– determining the properties of the coordination, such as timeliness, currency, completeness,
correctness, and consistency
– choosing the communication mechanisms that realize those properties. Important properties of the
communication mechanisms include stateful vs. stateless, synchronous vs. asynchronous,
guaranteed vs. non-guaranteed delivery, and performance-related properties such as throughput
and latency
Data Model
Decisions about the data model include:
– choosing the major data abstractions, their operations, and their properties. This includes
determining how the data items are created, initialized, accessed, persisted, manipulated,
translated, and destroyed.
– metadata needed for consistent interpretation of the data
– organization of the data. This includes determining whether the data is going to be kept in a
relational data base, a collection of objects or both
Management of Resources
Decisions for management of resources include:
– identifying the resources that must be managed and determining the limits for each
– determining which system element(s) manage each resource
23 | P a g e Software Architecture
– determining how resources are shared and the arbitration strategies employed when there is
contention
– determining the impact of saturation on different resources.
Binding Time
• The decisions in the other categories have an associated binding time decision. Examples of such binding
time decisions include:
– For allocation of responsibilities, you can have build-time selection of modules via a parameterized
build script.
– For choice of coordination model, you can design run-time negotiation of protocols.
– For resource management you can design a system to accept new peripheral devices plugged in
at run-time.
– For choice of technology, you can build an app-store for a smart phone that automatically
downloads the appropriate version of the app.
Choice of Technology
Choice of technology decisions involve:
– deciding which technologies are available to realize the decisions made in the other categories
– determining whether the tools to support this technology (IDEs, simulators, testing tools, etc.) are
adequate
– determining the extent of internal familiarity and external support for the technology (such as
courses, tutorials, examples, availability of contractors)
– determining the side effects of choosing a technology such as a required coordination model or
constrained resource management opportunities
– determining whether a new technology is compatible with the existing technology stack
Summary
Requirements for a system come in three categories.
1. Functional. These requirements are satisfied by including an appropriate set of responsibilities
within the design.
2. Quality attribute. These requirements are satisfied by the structures and behaviors of the
architecture.
3. Constraints. A constraint is a design decision that’s already been made.
To express a quality attribute requirement we use a quality attribute scenario. The parts of the scenario are:
1. Source of stimulus.
2. Stimulus
3. Environment.
4. Artifact.
5. Response.
6. Response measure.
24 | P a g e Software Architecture
• An architectural tactic is a design decision that affects a quality attribute response. The focus of a tactic is on
a single quality attribute response.
• Architectural patterns can be seen as “packages” of tactics.
• The seven categories of architectural design decisions are:
1. Allocation of responsibilities
2. Coordination model
3. Data model
4. Management of resources
5. Mapping among architectural elements
6. Binding time decisions
7. Choice of technology
Availability
Module 2 – L2
Outline
What is Availability?
Availability General Scenario
Tactics for Availability
A Design Checklist for Availability
Summary
Credits
These Slides are based on
• Software Architecture in Practice by
• Len Bass, Paul Clement and Rick Kazman
• Pearson © 2013
What is Availability?
• Availability refers to a property of software that it is there and ready to carry out its task when you need it to
be.
• This is a broad perspective and encompasses what is normally called reliability.
• Availability builds on reliability by adding the notion of recovery (repair).
• Fundamentally, availability is about minimizing service outage time by mitigating faults.
Availability Tactics
26 | P a g e Software Architecture
Detect Faults
• Ping/echo: asynchronous request/response message pair exchanged between nodes, used to determine
reachability and the round-trip delay through the associated network path.
• Monitor: a component used to monitor the state of health of other parts of the system. A system monitor can
detect failure or congestion in the network or other shared resources, such as from a denial-of-service
attack.
• Heartbeat: a periodic message exchange between a system monitor and a process being monitored.
• Timestamp: used to detect incorrect sequences of events, primarily in distributed message-passing
systems.
• Sanity Checking: checks the validity or reasonableness of a component’s operations or outputs; typically
based on a knowledge of the internal design, the state of the system, or the nature of the information under
scrutiny.
• Condition Monitoring: checking conditions in a process or device, or validating assumptions made during the
design.
• Voting: to check that replicated components are producing the same results. Comes in various flavors:
replication, functional redundancy, analytic redundancy.
• Exception Detection: detection of a system condition that alters the normal flow of execution, e.g. system
exception, parameter fence, parameter typing, timeout.
• Self-test: procedure for a component to test itself for correct operation.
– A protection group is a group of nodes where one or more nodes are “active,” with the remainder
serving as redundant spares.
• Passive Redundancy (warm spare): only the active members of the protection group process input traffic;
one of their duties is to provide the redundant spare(s) with periodic state updates.
• Spare (cold spare): redundant spares of a protection group remain out of service until a fail-over occurs, at
which point a power-on-reset procedure is initiated on the redundant spare prior to its being placed in
service.
• Exception Handling: dealing with the exception by reporting it or handling it, potentially masking the fault by
correcting the cause of the exception and retrying.
• Rollback: revert to a previous known good state, referred to as the “rollback line”.
• Software Upgrade: in-service upgrades to executable code images in a non-service-affecting manner.
• Retry: where a failure is transient retrying the operation may lead to success.
• Ignore Faulty Behavior: ignoring messages sent from a source when it is determined that those messages
are spurious.
• Degradation: maintains the most critical system functions in the presence of component failures, dropping
less critical functions.
• Reconfiguration: reassigning responsibilities to the resources left functioning, while maintaining as much
functionality as possible.
• Shadow: operating a previously failed or in-service upgraded component in a “shadow mode” for a
predefined time prior to reverting the component back to an active role.
• State Resynchronization: partner to active redundancy and passive redundancy where state information is
sent from active to standby components.
• Escalating Restart: recover from faults by varying the granularity of the component(s) restarted and
minimizing the level of service affected.
• Non-stop Forwarding: functionality is split into supervisory and data. If a supervisor fails, a router continues
forwarding packets along known routes while protocol information is recovered and validated.
Prevent Faults
• Removal From Service: temporarily placing a system component in an out-of-service state for the purpose
of mitigating potential system failures
• Transactions: bundling state updates so that asynchronous messages exchanged between distributed
components are atomic, consistent, isolated, and durable.
• Predictive Model: monitor the state of health of a process to ensure that the system is operating within
nominal parameters; take corrective action when conditions are detected that are predictive of likely future
faults.
• Exception Prevention: preventing system exceptions from occurring by masking a fault, or preventing it via
smart pointers, abstract data types, wrappers.
• Increase Competence Set: designing a component to handle more cases—faults—as part of its normal
operation.
Design Checklist for Availability
Allocation of Responsibilities
• Determine the system responsibilities that need to be highly available. Ensure that additional
responsibilities have been allocated to detect an omission, crash, incorrect timing, or incorrect response.
• Ensure that there are responsibilities to:
• log the fault
• notify appropriate entities (people or systems)
• disable source of events causing the fault
• be temporarily unavailable
• fix or mask the fault/failure
28 | P a g e Software Architecture
• Determine how and when architectural elements are bound. If late binding is used to alternate between
components that can themselves be sources of faults (e.g. processes, processors, communication
channels), ensure the chosen availability strategy is sufficient to cover faults introduced by all sources. E.g.
• If late binding is used to switch between processors that will be the subject of faults, will the fault detection
and recovery mechanisms work for all possible bindings?
• If late binding is used to change the definition or tolerance of what constitutes a fault (e.g., how long a
process can go without responding before a fault is assumed), is the recovery strategy chosen sufficient to
handle all cases? For example, if a fault is flagged after 0.1 ms, but the recovery mechanism takes 1.5
seconds to work, that might be an unacceptable mismatch.
• What are the availability characteristics of the late binding mechanism itself? Can it fail?
Choice of Technology
• Determine the available technologies that can (help) detect faults, recover from faults, re-introduce failed
components.
• Determine what technologies are available that help the response to a fault (e.g., event loggers).
• Determine the availability characteristics of chosen technologies themselves: What faults can they recover
from? What faults might they introduce into the system?
Summary
• Availability refers to the ability of the system to be available for use when a fault occurs.
• The fault must be recognized (or prevented) and then the system must respond.
• The response will depend on the criticality of the application and the type of fault
– can range from “ignore it” to “keep on going as if it didn’t occur.”
• Tactics for availability are categorized into detect faults, recover from faults and prevent faults.
• Detection tactics depend on detecting signs of life from various components.
• Recovery tactics are retrying an operation or maintaining redundant data or computations.
• Prevention tactics depend on removing elements from service or limiting the scope of faults.
• All availability tactics involve the coordination model.
Interoperability
Module 2 – L3
Outline
• What is Interoperability?
• Interoperability General Scenario
• Tactics for Interoperability
• A Design Checklist for Interoperability
• Summary
What is Interoperability?
• Interoperability is about the degree to which two or more systems can usefully exchange meaningful
information.
• Like all quality attributes, interoperability is not a yes-or-no proposition but has shades of meaning.
Interoperability Tactics
Locate
• Discover service:
• Locate a service through searching a known directory service.
• There may be multiple levels of indirection in this location process
– i.e. a known location points to another location that in turn can be searched for the
service.
Manage Interfaces
• Orchestrate: uses a control mechanism to coordinate, manage and sequence the invocation of services.
Orchestration is used when systems must interact in a complex fashion to accomplish a complex task.
• Tailor Interface: add or remove capabilities to an interface such as translation, buffering, or data-smoothing.
Summary
• Interoperability refers to the ability of systems to usefully exchange information.
33 | P a g e Software Architecture
• Achieving interoperability involves the relevant systems locating each other and then managing the
interfaces so that they can exchange information.
Modifiability
Chapter Outline
What is Modifiability?
Modifiability General Scenario
Tactics for Modifiability
A Design Checklist for Modifiability
Summary
What is Modifiability?
Modifiability is about change and our interest in it is in the cost and risk of making changes.
To plan for modifiability, an architect has to consider three questions:
– What can change?
– What is the likelihood of the change?
– When is the change made and who makes it?
Modifiability Tactics
Increase Cohesion
Increase Semantic Coherence: If the responsibilities A and B in a module do not serve the same purpose, they
should be placed in different modules. This may involve creating a new module or it may involve moving a
responsibility to an existing module.
Reduce Coupling
Encapsulate: Encapsulation introduces an explicit interface to a module. This interface includes an API and its
associated responsibilities, such as “perform a syntactic transformation on an input parameter to an internal
representation.”
Use an Intermediary: Given a dependency between responsibility A and responsibility B (for example, carrying out A
first requires carrying out B), the dependency can be broken by using an intermediary.
Restrict Dependencies restricts the modules which a given module interacts with or depends on.
Refactor: undertaken when two modules are affected by the same change because they are (at least partial)
duplicates of each other.
Abstract Common Services: where two modules provide not-quite-the-same but similar services, it may be cost-
effective to implement the services just once in a more general (abstract) form.
Defer Binding
In general, the later in the life cycle we can bind values, the better.
If we design artifacts with built-in flexibility, then exercising that flexibility is usually cheaper than hand-coding a
specific change.
However, putting the mechanisms in place to facilitate that late binding tends to be more expensive.
Summary
Modifiability deals with change and the cost in time or money of making a change, including the extent to which this
modification affects other functions or quality attributes.
Tactics to reduce the cost of making a change include making modules smaller, increasing cohesion, and reducing
coupling. Deferring binding will also reduce the cost of making a change.
38 | P a g e Software Architecture
Performance
Module 2
Chapter Outline
What is Performance?
Performance General Scenario
Tactics for Performance
A Design Checklist for Performance
Summary
What is Performance?
• Performance is about time and the software system’s ability to meet timing requirements.
• When events occur – interrupts, messages, requests from users or other systems, or clock events marking
the passage of time – the system, or some element of the system, must respond to them in time.
• Characterizing the events that can occur (and when they can occur) and the system or element’s time-
based response to those events is the essence is discussing performance.
Performance Tactics
39 | P a g e Software Architecture
Manage Resources
• Increase Resources: Faster processors, additional processors, additional memory, and faster networks all
have the potential for reducing latency.
• Increase Concurrency: If requests can be processed in parallel, the blocked time can be reduced.
Concurrency can be introduced by processing different streams of events on different threads or by creating
additional threads to process different sets of activities.
• Maintain Multiple Copies of Computations: The purpose of replicas is to reduce the contention that would
occur if all computations took place on a single server.
• Maintain Multiple Copies of Data: keeping copies of data (possibly one a subset of the other) on storage
with different access speeds.
• Bound Queue Sizes: control the maximum number of queued arrivals and consequently the resources used
to process the arrivals.
• Schedule Resources: When there is contention for a resource, the resource must be scheduled.
Module 2
Security
Chapter Outline
What is Security?
Security General Scenario
Tactics for Security
A Design Checklist for Security
Summary
What is Security?
• Security is a measure of the system’s ability to protect data and information from unauthorized access while
still providing access to people and systems that are authorized.
• An action taken against a computer system with the intention of doing harm is called an attack and can take
a number of forms.
• It may be an unauthorized attempt to access data or services or to modify data, or it may be intended to
deny services to legitimate users.
Security has three main characteristics, called CIA:
– Confidentiality is the property that data or services are protected from unauthorized access. For
example, a hacker cannot access your income tax returns on a government computer.
– Integrity is the property that data or services are not subject to unauthorized manipulation. For
example, your grade has not been changed since your instructor assigned it.
– Availability is the property that the system will be available for legitimate use. For example, a
denial-of-service attack won’t prevent you from ordering a book from an online bookstore.
Other characteristics that support CIA are
– Authentication verifies the identities of the parties to a transaction and checks if they are truly who
they claim to be. For example, when you get an e-mail purporting to come from a bank,
authentication guarantees that it actually comes from the bank.
– Nonrepudiation guarantees that the sender of a message cannot later deny having sent the
message and that the recipient cannot deny having received the message. For example, you
cannot deny ordering something from the Internet, or the merchant cannot disclaim getting your
order.
– Authorization grants a user the privileges to perform a task. For example, an online banking system
authorizes a legitimate user to access his account.
43 | P a g e Software Architecture
Security Tactics
44 | P a g e Software Architecture
Detect Attacks
• Detect Intrusion: compare network traffic or service request patterns within a system to a set of signatures
or known patterns of malicious behavior stored in a database.
• Detect Service Denial: comparison of the pattern or signature of network traffic coming into a system to
historic profiles of known Denial of Service (DoS) attacks.
• Verify Message Integrity: use techniques such as checksums or hash values to verify the integrity of
messages, resource files, deployment files, and configuration files.
• Detect Message Delay: checking the time that it takes to deliver a message, it is possible to detect
suspicious timing behavior.
Resist Attacks
• Identify Actors: identify the source of any external input to the system.
• Authenticate Actors: ensure that an actor (user or a remote computer) is actually who or what it purports to
be.
• Authorize Actors: ensuring that an authenticated actor has the rights to access and modify either data or
services.
• Limit Access: limiting access to resources such as memory, network connections, or access points.
• Limit Exposure: minimize the attack surface of a system by having the fewest possible number of access
points.
• Encrypt Data: apply some form of encryption to data and to communication.
• Separate Entities: can be done through physical separation on different servers attached to different
networks, the use of virtual machines, or an “air gap”.
• Change Default Settings: Force the user to change settings assigned by default.
React to Attacks
• Revoke Access: limit access to sensitive resources, even for normally legitimate users and uses, if an attack
is suspected.
45 | P a g e Software Architecture
• Lock Computer: limit access to a resource if there are repeated failed attempts to access it.
• Inform Actors: notify operators, other personnel, or cooperating systems when an attack is suspected or
detected.
Summary
• Attacks against a system can be characterized as attacks against the confidentiality, integrity, or availability
of a system or its data.
• This leads to many of the tactics used to achieve security. Identifying, authenticating, and authorizing actors
are tactics intended to determine which users or systems are entitled to what kind of access to a system.
• No security tactic is foolproof and systems will be compromised. Hence, tactics exist to detect an attack,
limit the spread of any attack, and to react and recover from an attack.
Module 2 - Testability
Chapter Outline What is Testability? - Testability General Scenario - Tactics for Testability - A Design Checklist for
Testability - Summary
What is Testability?
Software testability refers to the ease with which software can be made to demonstrate its faults through (typically
execution-based) testing.
Specifically, testability refers to the probability, assuming that the software has at least one fault, that it will fail on its
next test execution.
If a fault is present in a system, then we want it to fail during testing as quickly as possible.
For a system to be properly testable, it must be possible to control each component’s inputs (and possibly manipulate
its internal state) and then to observe its outputs (and possibly its internal state).
Environment Design time, development time, compile time, integration time, deployment time, run time
Artifacts The portion of the system being tested
Response One or more of the following: execute test suite and capture results; capture activity that
resulted in the fault; control and monitor the state of the system
Response One or more of the following: effort to find a fault or class of faults, effort to achieve a given
Measure percentage of state space coverage; probability of fault being revealed by the next test; time to
perform tests; effort to detect faults; length of longest dependency chain in test; length of time to
prepare test environment; reduction in risk exposure (size(loss) * prob(loss))
Testability Tactics
49 | P a g e Software Architecture
Testability Tactics
Record/ Limit
Playback Non-determinism
Localize State
Storage
Abstract Data
Sources
Sandbox
Executable
Assertions
Limit Complexity
• Limit Structural Complexity: avoiding or resolving cyclic dependencies between components, isolating and
encapsulating dependencies on the external environment, and reducing dependencies between
components in general.
• Limit Non-determinism: finding all the sources of non-determinism, such as unconstrained parallelism, and
weeding them out as far as possible.
Summary
• Ensuring that a system is easily testable has payoffs both in terms of the cost of testing and the reliability of
the system.
• Controlling and observing the system state are a major class of testability tactics.
• Complex systems are difficult to test because of the large state space in which their computations take
place, and because of the larger number of interconnections among the elements of the system.
Consequently, keeping the system simple is another class of tactics that supports testability.
Module 2 – Usability
Chapter Outline
What is Usability?
Usability General Scenario
Tactics for Usability
A Design Checklist for Usability
Summary
What is Usability?
52 | P a g e Software Architecture
Usability is concerned with how easy it is for the user to accomplish a desired task and the kind of user support the
system provides.
Over the years, a focus on usability has shown itself to be one of the cheapest and easiest ways to improve a
system’s quality (or, more precisely, the user’s perception of quality).
What is Usability?
Usability comprises the following areas:
– Learning system features.
– Using a system efficiently.
– Minimizing the impact of errors.
– Adapting the system to user needs.
– Increasing confidence and satisfaction.
Artifacts System or the specific portion of the system with which the user is interacting.
Response The system should either provide the user with the features needed or anticipate the user’s
needs.
Response Measure One or more of the following: task time, number of errors, number of tasks accomplished,
user satisfaction, gain of user knowledge, ratio of successful operations to total operations,
or amount of time or data lost when an error occurs.
Usability Tactics
Usability Tactics
Allocation of Ensure that additional system responsibilities have been allocated, as needed, to
Responsibilities assist the user in
learning how to use the system
efficiently achieving the task at hand
adapting and configuring the system
recovering from user and system errors
Coordination Model Determine whether the properties of system elements’ coordination—timeliness,
currency, completeness, correctness, consistency—affect how a user learns to
use the system, achieves goals or completes tasks, adapts and configures the
system, recovers from user and system errors, increases confidence and
satisfaction.
For example, can the system respond to mouse events and give semantic
feedback in real time? Can long-running events be canceled in a reasonable
amount of time?
Data Model Determine the major data abstractions that are involved with user-perceivable
behavior.
Ensure these major data abstractions, their operations, and their properties have
been designed to assist the user in achieving the task at hand, adapting and
configuring the system, recovering from user and system errors, learning how to
use the system, and increasing satisfaction and user confidence
For example, the data abstractions should be designed to support undo and
cancel operations: the transaction granularity should not be so great that
canceling or undoing an operation takes an excessively long time.
Mapping Among Determine what mapping among architectural elements is visible to the end user
Architectural Elements (for example, the extent to which the end user is aware of which services are
local and which are remote).
For those that are visible, determine how this affects the ways in which, or the
ease with which the user will learn how to use the system, achieve the task at
hand, adapt and configure the system, recover from user and system errors, and
increase confidence and satisfaction.
Resource Management Determine how the user can adapt and configure the system’s use of resources.
Ensure that resource limitations under all user-controlled configurations will not
make users less likely to achieve their tasks. For example, attempt to avoid
configurations that would result in excessively long response times.
Ensure that the level of resources will not affect the users’ ability to learn how to
use the system, or decrease their level of confidence and satisfaction with the
system.
Binding Time Determine which binding time decisions should be under user control and ensure
that users can make decisions that aid in usability.
For example, if the user can choose, at run-time, the system’s configuration, or
its communication protocols, or its functionality via plug-ins, you need to ensure
that such choices do not adversely affect the user’s ability to learn system
features, use the system efficiently, minimize the impact of errors, further adapt
and configure the system, or increase confidence and satisfaction.
Choice of Technology Ensure the chosen technologies help to achieve the usability scenarios that
apply to your system. For example, do these technologies aid in the creation of
on-line help, training materials, and user feedback collection.
55 | P a g e Software Architecture
How usable are any of your chosen technologies? Ensure the chosen
technologies do not adversely affect the usability of the system (in terms of
learning system features, using the system efficiently, minimizing the impact of
errors, or adapting/configuring the system, increase confidence and satisfaction).
Summary
Architectural support for usability involves both allowing the user to take the initiative in circumstances such as
cancelling a long running command, undoing a completed command, and aggregating data and commands.
To predict user or system response, the system must keep a model of the user, the system, and the task.
56 | P a g e Software Architecture
Summary
• There are many other quality attributes than the seven that we cover in detail.
58 | P a g e Software Architecture
• Taxonomies of attributes may offer some help, but their disadvantages often outweigh their advantages.
• You may need to design or analyze a system for a “new” quality attribute. While this may be challenging, it is
doable.
59 | P a g e Software Architecture
Architecture design
Design strategy
Steps of Attribute-Driven design
Architecting in Agile projects
Designing an Architecture
• Design Strategy
• The Attribute-Driven Design Method
• The Steps of ADD
Agility
• Agile processes were a response to a need for projects to
• be more responsive to their stakeholders
• be quicker to develop functionality that users care about
• show more and earlier progress in a project’s life cycle
• be less burdened by documenting aspects of a project that would inevitably change.
• These needs are not in conflict with architecture.
• The question for a software project is not “Should I do Agile or architecture?” Instead ask:
• “How much architecture should I do up front versus how much should I defer until the project’s
requirements have solidified somewhat?”
• “How much of the architecture should I formally document, and when?”
• Agile and architecture are happy companions for many software projects.
6. The most efficient and effective method of conveying information to and within a development team is face-
to-face conversation.
7. Working software is the primary measure of progress.
8. Agile processes promote sustainable development. The sponsors, developers, and users should be able to
maintain a constant pace indefinitely.
9. Continuous attention to technical excellence and good design enhances agility.
10. Simplicity—the art of maximizing the amount of work not done—is essential.
11. The best architectures, requirements, and designs emerge from self-organizing teams.
12. At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior
accordingly.
Agile
• These processes were initially employed on small- to medium-sized projects with short time frames and
enjoyed considerable success.
• They were not often used for larger projects, particularly those with distributed development.
• These lines show that there is a sweet spot for each project.
– For the 10KSLOC project, the sweet spot is at the far left. Devoting much time to up-front work is a
waste for a small project.
– For the 100 KSLOC project, the sweet spot is around 20 percent of the project schedule.
– For the 1,000 KSLOC project, the sweet spot is around 40 percent of the project schedule.
62 | P a g e Software Architecture
Lesson
• Making architecture processes agile does not require radical re-invention of either Agile practices or
architecture methods.
• The WebArrow team’s emphasis on experimentation proved the key factor.
Summary
• The Agile Manifesto and principles value close-knit teams, with continuous, frequent delivery of working
software.
• Agile processes were initially employed on small- to medium-sized projects with short time frames. They
were seldom used for larger projects, particularly with distributed development.
• Large-scale successful projects need a blend of agile and architecture.
• Agile architects take a middle ground, proposing an initial architecture and running with that, until its
technical debt becomes too great, at which point they need to refactor.
• Boehm and Turner found that projects have a “sweet spot” where up-front architecture planning pays off.
64 | P a g e Software Architecture
Views
• Representation of a coherent set of architectural elements , as written by and read by system stakeholders.
Documenting
• “Documenting an architecture is a matter of documenting the relevant views and then adding a
documentation that applies to more than one view.”
Solution to a Problem
• Problem
• Architecture documents do not address the concerns of all stakeholders .
• Deferent Stakeholders : end-user, system engineers, developers and project managers.
• Architecture documents contained complex diagrams some times they are hard to be represented
on the documentation.
• Solution
• Using different notations for several Views each one addressing one specific set for concerns.
4+1 Model -
Philippe Kruchten, Rational Software Corp.
Logical View
• The logical view, which is the object model of the design (when an object-oriented design method is used)
Viewer: End-user
considers: Functional requirements- What are the services must be provided by the system to the users.
65 | P a g e Software Architecture
Process View
The process view, which captures the concurrency and synchronization aspects of the design(The process
decomposition).
viewer: Integrators
considers: Non - functional requirements (scalability, concurrency, and performance)
style: Garlan and Shaw ‘s Architecture styles.
66 | P a g e Software Architecture
Notation-
Philippe Kruchten, Rational Software Corp.
Development View
The development view, which describes the static organization of the software in its development environment.
Viewer: Programmers and Software Managers
considers: software module organization.
(Hierarchy of layers, software management, reuse, constraints of tools).
Notation: the Booch notation.
Style: layered style
67 | P a g e Software Architecture
Physical View
the physical view, which describes the mapping(s) of the software onto the hardware and reflects its distributed
aspect.
Viewer: System Engineers
Considers: Non-functional requirement (reliability, availability and performance). regarding to underlying hardware.
There may be two architecture:
– Test and development
– deployment
68 | P a g e Software Architecture
Scenarios
(Putting all “4 views” together)
Viewer: All users and Evaluators.
Considers: System consistency and validity
Notation: Similar to logical view
Scenario example-
Philippe Kruchten, Rational Software Corp.
70 | P a g e Software Architecture
Iterative process
Not all architectures need all views.
A scenario-driven approach to develop the system is used to handle the iterative.
Documenting the architecture:
– Software architecture document: follows closely “4+1” views.
– Software design guidelines: it captured the most important design decisions that must be respected
to maintain the architectural integrity.
Annotation:
• “4+1 views” methodology successfully used in the industry
– Air Traffic Control
– Telecom
• This paper missing the tools to integrate these views which lead to an inconsistency problem.
• The inconsistency problem is more tangible in the maintenance of the architecture.
Summary
72 | P a g e Software Architecture
73 | P a g e Software Architecture
example
• A module structure is the set of the system's modules and their organization.
• A module view is the representation of that structure, as documented by and used by some system
stakeholders.
• These terms are often used interchangeably, but we will adhere to these definitions.
Architectural structures
Module structures.
• Here the elements are modules, which are units of implementation.
• Modules represent a code-based way of considering the system.
• They are assigned areas of functional responsibility.
• There is less emphasis on how the resulting software manifests itself at runtime.
• Module structures allow us to answer questions such as
• What is the primary functional responsibility assigned to each module?
• What other software elements is a module allowed to use?
• What other software does it actually use?
• What modules are related to other modules by generalization or specialization (i.e., inheritance)
relationships?
Component-and-connector structures.
• Here the elements are
• runtime components (which are the principal units of computation) and
• connectors (which are the communication vehicles among components).
• Component-and-connector structures help answer questions such as
• What are the major executing components and how do they interact?
• What are the major shared data stores?
• Which parts of the system are replicated?
• How does data progress through the system?
• What parts of the system can run in parallel?
• How can the system's structure change as it executes?
Allocation structures.
• Allocation structures show the relationship between
• the software elements and
• the elements in one or more external environments in which the software is created and executed.
• They answer questions such as
• What processor does each software element execute on?
• In what files is each element stored during development, testing, and system building?
• What is the assignment of software elements to development teams?
74 | P a g e Software Architecture
Architectural Design
3 structures – 3 broad decision types
• How is the system to be structured as a set of code units (modules)?
• How is the system to be structured as a set of elements that have
• runtime behavior (components) and
• interactions (connectors)?
• How is the system to relate to nonsoftware structures in its environment
• (i.e., CPUs, file systems, networks, development teams, etc.)?
SOFTWARE STRUCTURES
Module
Decomposition.
• The units are modules related to each other by the "is a submodule of " relation, showing how larger
modules are decomposed into smaller ones recursively until they are small enough to be easily understood.
• Modules in this structure represent a common starting point for design, as the architect enumerates what
the units of software will have to do and assigns each item to a module for subsequent (more detailed)
design and eventual implementation.
• Modules often have associated products (i.e., interface specifications, code, test plans, etc.).
• The decomposition structure provides a large part of the system's modifiability, by ensuring that likely
changes fall within the purview of at most a few small modules.
• It is often used as the basis for the development project's organization, including the structure of the
documentation, and its integration and test plans. The units in this structure often have organization-specific
names.
• Certain U.S. Department of Defense standards, for instance, define Computer Software Configuration Items
(CSCIs) and Computer Software Components (CSCs), which are units of modular decomposition.
Uses
• The units of this important but overlooked structure are also modules, or (in circumstances where a finer
grain is warranted) procedures or resources on the interfaces of modules.
• The units are related by the uses relation.
• One unit uses another if the correctness of the first requires the presence of a correct version (as opposed
to a stub) of the second.
• The uses structure is used to engineer systems that can be easily extended to add functionality or from
which useful functional subsets can be easily extracted.
75 | P a g e Software Architecture
• The ability to easily subset a working system allows for incremental development.
Layered
• When the uses relations in this structure are carefully controlled in a particular way, a system of layers
emerges, in which a layer is a coherent set of related functionality.
• In a strictly layered structure, layer n may only use the services of layer n - 1.
• Many variations of this (and a lessening of this structural restriction) occur in practice, however.
• Layers are often designed as abstractions (virtual machines) that hide implementation specifics below from
the layers above, engendering portability.
Class, or generalization.
• The module units in this structure are called classes.
• The relation is "inherits-from" or "is-an-instance-of."
• This view supports reasoning about collections of similar behavior or capability (i.e., the classes that other
classes inherit from) and parameterized differences which are captured by subclassing.
• The class structure allows us to reason about re-use and the incremental addition of functionality.
Concurrency
• This component-and-connector structure allows the architect to determine opportunities for parallelism and
the locations where resource contention may occur.
• The units are components and the connectors are "logical threads."
• A logical thread is a sequence of computation that can be allocated to a separate physical thread later in the
design process.
• The concurrency structure is used early in design to identify the requirements for managing the issues
associated with concurrent execution.
Shared data, or repository.
• This structure comprises components and connectors that create, store, and access persistent data.
• If the system is in fact structured around one or more shared data repositories, this structure is a good one
to illuminate.
• It shows how data is produced and consumed by runtime software elements, and it can be used to ensure
good performance and data integrity.
Client-server.
• If the system is built as a group of cooperating clients and servers, this is a good component-and-connector
structure to illuminate.
• The components are the clients and servers, and the connectors are protocols and messages they share to
carry out the system's work.
• This is useful for separation of concerns (supporting modifiability), for physical distribution, and for load
balancing (supporting runtime performance).
76 | P a g e Software Architecture
Allocation
Deployment
• The deployment structure shows how software is assigned to hardware-processing and communication
elements.
• The elements are software (usually a process from a component-and-connector view), hardware entities
(processors), and communication pathways.
• Relations are "allocated-to," showing on which physical units the software elements reside, and "migrates-
to," if the allocation is dynamic.
• This view allows an engineer to reason about performance, data integrity, availability, and security.
• It is of particular interest in distributed or parallel systems.
Implementation.
• This structure shows how software elements (usually modules) are mapped to the file structure(s) in the
system's development, integration, or configuration control environments.
• This is critical for the management of development activities and build processes.
Work assignment.
• This structure assigns responsibility for implementing and integrating the modules to the appropriate
development teams.
• Having a work assignment structure as part of the architecture makes it clear that the decision about who
does the work has architectural as well as management implications.
• The architect will know the expertise required on each team.
• Also, on large multi-sourced distributed development projects, the work assignment structure is the means
for calling out units of functional commonality and assigning them to a single team, rather than having them
implemented by everyone who needs them.
77 | P a g e Software Architecture
Decomposition Is a submodule of; shares secret with Resource allocation and project structuring and
planning; information hiding, encapsulation;
configuration control
Uses Requires the correct presence of Engineering subsets; engineering extensions
Layered Requires the correct presence of; uses the Incremental development; implementing systems on
services of; provides abstraction to top of "virtual machines" portability
Class Is an instance of; shares access methods In object-oriented design systems, producing rapid
of almost-alike implementations from a common
template
Client-Server Communicates with; depends on Distributed operation; separation of concerns;
performance analysis; load balancing
Process Runs concurrently with; may run Scheduling analysis; performance analysis
concurrently with; excludes; precedes; etc.
Concurrency Runs on the same logical thread Identifying locations where resource contention
exists, where threads may fork, join, be created or
be killed
Shared Data Produces data; consumes data Performance; data integrity; modifiability
Deployment Allocated to; migrates to Performance, availability, security analysis
Implementation Stored in Configuration control, integration, test activities
Work Assignment Assigned to Project management, best use of expertise,
management of commonality
Benefits
• What are the benefits of layered architecture?
Memcached
memcached is a high-performance, distributed memory object caching
system, generic in nature, but originally intended for use in speeding up
dynamic web applications by alleviating database load.
You can think of it as a short-term memory for your applications.
memcached allows you to take memory from parts of your system where
you have more than you need and make it accessible to areas where you
have less than you need.
Flexible grids
Allows varying layout
depending on screen
size
HTML5 and CSS3 help
in specifying the display
arrangement
Presentation layer
Have you used any other techniques in Presentation layer?
82 | P a g e Software Architecture
Business layer
Intent:
• Provide a unified interface to a set of interfaces in a subsystem.
• Facade defines a higher-level interface that makes the subsystem easier to use.
• It typically involves a single wrapper class which contains a set of members required by client.
Example of Application façade: Flight booking
83 | P a g e Software Architecture
Session management
84 | P a g e Software Architecture
Once an activity is completed, the engine invokes the next step in the process
The next step / activity could be a manual one or an automated one
Popular engines: BizTalk Server, Oracle BPEL processor, IBM WebSphere Process Server
Business layer
We saw:
• Façade
• Session mangement
• Work flow engine
• Aspect oriented design
Have you used any other technique in Business layer?
Data layer
Have you used any other technique in Data layer?
Services layer
Question
Have you used any other techniques in a layered architecture?
Exercise 1
87 | P a g e Software Architecture
Exercise 2
What software mechanism will you use to improve the performance in the following situation:
• One of the frequently used screens in Aadhaar system is citizen registration.
• This screen has a fields “State” and “District” and “Town”, which are Drop-down fields
• It takes time to loading this screen due to the large number of states, districts and towns in India
Solution
• Cache states, districts and towns in the backend
• Use AJAX for dynamic loading of districts and towns
Exercise 3:
• Suppose you are developing a hotel reservation system.
• You want to provide is an interface to externals applications such as Makemytrip.com, to inquire about
availability of rooms and book rooms.
• What layer would you build and what will be the component (s) in that layer?
Answer
Services layer is needed to provide interface to external systems.
This layer will have components such as
– Get room availability (from date, to date) return (# rooms available by type of room)
– Reserve room (# of rooms, type of room, from date, to date) Return (Success / Failure)
Exercise 4
Suppose you are building a complex logistics system for a shipping & container company
Users wanting to send goods via containers will login to the system and place their requests
A number of modules need to be called for this:
• Find out the nearest location of an empty container
• Find a the best transporter to pick up the goods
• Find a ship that is scheduled leave to the desired destination and has spare capacity to load the
container
As an architect you want to hide these modules from the client layer.
What technique will you use and in which layer?
Answer -
• In the Business layer, provide a unified API – façade - to place a shipping request
• The façade will in turn make use of modules to search for appropriate container, appropriate transporter,
appropriate ship, etc.
SSL
88 | P a g e Software Architecture
1. Browser connects to a web server (website) secured with SSL (https). Browser requests that the server
identify itself.
2. Server sends a copy of its SSL Certificate, including the server’s public key.
3. Browser checks the certificate root against a list of trusted CAs and that the certificate is unexpired,
unrevoked, and that its common name is valid for the website that it is connecting to. If the browser trusts
the certificate, it creates, encrypts, and sends back a symmetric session key using the server’s public key.
4. Server decrypts the symmetric session key using its private key and sends back an acknowledgement
encrypted with the session key to start the encrypted session.
5. Server and Browser now encrypt all transmitted data with the session key.
SSL
1. Browser requests that the server identify itself.
2. Server sends a copy of its SSL Certificate
3. Browser checks the certificate. and sends back a symmetric session key
4. Server sends back an acknowledgement.
5. Server and Browser now encrypt all transmitted data with the session key.
IPSec is an Internet Engineering Task Force (IETF) standard suite of protocols that provides data authentication,
integrity, and confidentiality as data is transferred between communication points across IP networks.
IPSec provides data security at the IP packet level.
Session management
• A web session is a sequence of network HTTP request and response transactions associated to the same
user.
• Modern and complex web applications require the retaining of information or status about each user for the
duration of multiple requests.
90 | P a g e Software Architecture
• Outsiders are chosen because they possess specialized knowledge or experience, or long experience
successfully evaluating architectures.
• Managers tend to be more inclined to listen to problems uncovered by an outside team.
• An outside team tends to be used to evaluate complete architectures.
Scenario scribe - Writes scenarios on flipchart or whiteboard during scenario elicitation; captures agreed-on wording
of each scenario, halting discussion until exact wording is captured
Proceedings scribe - Captures proceedings in electronic form on laptop or workstation: raw scenarios, issue(s) that
motivate each scenario (often lost in the wording of the scenario itself), and resolution of each scenario when applied
to architecture(s); also generates a printed list of adopted scenarios for handout to all participants
Questioner - Raises issues of architectural interest, usually related to the quality attributes in which he or she has
expertise
Intangible Outputs
• There are also intangible results of an ATAM-based evaluation. These include
• a sense of community on the part of the stakeholders
• open communication channels between the architect and the stakeholders
• a better overall understanding on the part of all participants of the architecture and its strengths
and weaknesses.
• While these results are hard to measure,
• they are no less important than the others and often are the longest-lasting.
• The evaluation team examines the highest-ranked scenarios one at a time; the architect is asked to explain
how the architecture supports each one.
• Evaluation team members—especially the questioners—probe for the architectural approaches that the
architect used to carry out the scenario.
• Along the way, the evaluation team documents the relevant architectural decisions and identifies and
catalogs their risks, nonrisks, sensitivity points, and tradeoffs. Examples:
• Risk: The frequency of heartbeats affects the time in which the system can detect a failed
component. Some assignments will result in unacceptable values of this response.
• Sensitivity point: The number of simultaneous database clients will affect the number of
transactions that a database can process per second.
• Tradeoff: The heartbeat frequency determines the time for detecting a fault. Higher frequency leads
to better availability but consumes more processing time and communication bandwidth (potentially
reducing performance).
• These, in turn, may catalyze a deeper analysis.
• The analysis is not meant to be comprehensive. The key is to elicit sufficient architectural information to
establish a link between the architectural decisions made and the quality attribute requirements that need to
be satisfied.
95 | P a g e Software Architecture
Example of an Analysis
• In this step the evaluation team performs the same activities as in step 6, using the highest-ranked, newly
generated scenarios.
• The evaluation team guides the architect in the process of carrying out the highest ranked new scenarios.
• The architect explains how relevant architectural decisions contribute to realizing each one.
• This step might cover the top 5-10 scenarios, as time permits.
2. Present 0.25 The participants are expected to understand the system and its business goals
business drivers hours and their priorities. A brief review ensures that these are fresh in everyone’s mind
and that there are no surprises.
3. Present 0.5 All participants are expected to be familiar with the system. A brief overview of the
architecture hours architecture, using at least module and C&C views, is presented. 1-2 scenarios
are traced through these views.
4. Identify 0.25 The architecture approaches for specific quality attribute concerns are identified
architectural hours by the architect. This may be done as a portion of step 3.
approaches
5. Generate QA 0.5- Scenarios might exist: part of previous evaluations, part of design, part of
utility tree 1.5 requirements elicitation. Put these in a tree. Or, a utility tree may already exist.
hours
6. Analyze 2-3 This step—mapping the highly ranked scenarios onto the architecture—
architectural hours consumes the bulk of the time and can be expanded or contracted as needed.
approaches
7. Brainstorm 0 This step can be omitted as the assembled (internal) stakeholders are expected
scenarios hours to contribute scenarios expressing their concerns in step 5.
8. Analyze 0 This step is also omitted, since all analysis is done in step 6.
architectural hours
approaches
9. Present results 0.5 At the end of an evaluation, the team reviews the existing and newly discovered
hours risks, nonrisks, sensitivities, and tradeoffs and discusses whether any new risk
themes have arisen.
Summary
• If a system is important enough for you to explicitly design its architecture, then that architecture should be
evaluated.
• The number of evaluations and the extent of each evaluation may vary from project to project.
• A designer should perform an evaluation during the process of making an important decision.
• Lightweight evaluations can be performed several times during a project as a peer review exercise.
• The ATAM is a comprehensive method for evaluating software architectures. It works by having project
decision makers and stakeholders articulate a precise list of quality attribute requirements (in the form of
scenarios) and by illuminating the architectural decisions relevant to carrying out each high-priority scenario.
The decisions can then be understood in terms of risks or non-risks to find any trouble spots in the
architecture.
• Lightweight Architecture Evaluation, based on the ATAM, provides an inexpensive, low-ceremony
architecture evaluation that can be carried out in an afternoon.
Module 5 – Ensuring conformance to architecture
Code may drift away from Architecture
Examples of drift:
• Not sticking to the discipline of layers – an object in one layer calling an object located in a layer beyond the
adjacent layer
• Accessing data base directly without going through data access layer
• Notifying different modules one by one instead of using ‘publish – subscribe’ model,
• Not making use of a common logging mechanism, etc.
What other architecture violations have you come across?
98 | P a g e Software Architecture
Use Frameworks
Examples of frameworks:
• Spring
• Hibernate
• Autosar - AUTomotive Open System Architecture
Experience sharing – Can you give examples of other frameworks that you have used?
Other examples of frameworks
• Publish – Subscribe framework (JMS)
• Workflow framework of SalesForce.com
• Rules engine (DROOLS)
• Logging framework - Log4J (for logging events)
Exercise
• What other techniques can we think of to ensure that code does not drift away from architecture?
What other techniques can we think of to ensure that code does not drift away from architecture?
• Educate new team members about the architecture
• Do Code reviews
• Create folders for each architectural aspect such as layer, service, UI, external interfaces, etc. and
follow a discipline of storing the code in respective folders
100 | P a g e Software Architecture
Experience sharing – Can you describe how your architect helped the testing team?
Sonar tool allows definition of layers and vertical slices through the layers
The tool will populate the layers & slices with components / elements
Architecture analysis
• Check conformance to architecture
• Ex. There could be restriction that a layer calls objects in adjacent layers only. Or
• Ex. All db access should be via an entity bean only
No portion of the application should depend upon Junit. Based on this specification, Sonar detects the rule violation
Example of architecture violation (detected by Sonar)
106 | P a g e Software Architecture
All database access is supposed to be managed by entity beans. Discovered by tool Disco Tect
M6 Architectural patterns
Layered
MVC
Publish-subscribe
Pipe & Filter
Service Oriented Architecture and Micro-services
Introducing Patterns
Patterns
An architectural pattern establishes a relationship between:
A context.
A problem.
A solution.
Context
A context.
A recurring, common situation in the world that gives rise to a problem.
Problem – A problem.
The problem, appropriately generalized, that arises in the given context.
Solution – A solution.
107 | P a g e Software Architecture
A successful architectural resolution to the problem, appropriately abstracted. The solution for a pattern is determined
and described by:
– A set of element types (for example, data repositories, processes, and objects)
– A set of interaction mechanisms or connectors (for example, method calls, events, or message
bus)
– A topological layout of the components
– A set of semantic constraints covering topology, element behavior, and interaction mechanisms
Properties of Patterns
• Problem…Context…Solution
• Existing, well-proven design experience
• Identify and Specify Abstractions
• Provide Common Vocabulary
• Means of documenting Software Architecture
• Support construction with defined properties
• Help build complex and heterogenous architectures
• Help to manage software complexity
Problem…Context…Solution
• A pattern addresses a recurring design problem that arises in specific design situations, and presents a
solution to it.
• If the problem is supporting variability in user interfaces. This problem may arise when developing software
systems with human-computer interaction. You can solve this problem by a strict separation of
responsibilities: the core functionality of the application is separated from its user interface.
Definition: Pattern
A pattern for software architecture describes a particular recurring design problem that arises in specific design
contexts, and presents a well-proven generic scheme for its solution. The solution scheme is specified by describing
its constituent components, their responsibilities and relationships, and the ways in which they collaborate.
Categories
From Mud to Structure.
• Patterns in this category help you to avoid a 'sea' of components or objects.
• In particular, they support a controlled decomposition of an overall system task into cooperating subtasks.
• The category includes
• the Layers pattern
• the Pipes and Filters pattern
• the Blackboard pattern
Distributed Systems.
• This category includes one pattern.
• Broker
• and refers to two patterns in other categories,
• Microkernel
• Pipes and Filters
• The Broker pattern provides a complete infrastructure for distributed applications.
• The Microkernel and Pipes and Filters patterns only consider distribution as a secondary concern and are
therefore listed under their respective primary categories.
Interactive Systems.
• This category comprises two patterns,
• the Model-View-Controller pattern (well-known from Smalltalk,)
• the Presentation-Abstraction-Control pattern.
• Both patterns support the structuring of software systems that feature human-computer interaction.
Adaptable Systems.
• This category includes
• The Reflection pattern
• the Microkernel pattern
• strongly support extension of applications and their adaptation to evolving technology and changing
functional requirements.
Solution: To achieve this separation of concerns, the layered pattern divides the software into units called layers.
Each layer is a grouping of modules that offers a cohesive set of services. The usage must be unidirectional. Layers
completely partition a set of software, and each partition is exposed through a public interface.
A Typical Solution
Overview: The layered pattern defines layers (groupings of modules that offer a cohesive set of services) and a
unidirectional allowed-to-use relation among the layers.
Elements: Layer, a kind of module. The description of a layer should define what modules the layer contains.
Relations: Allowed to use. The design should define what the layer usage rules are and any allowable exceptions.
Constraints:
– Every piece of software is allocated to exactly one layer.
– There are at least two layers (but usually there are three or more).
– The allowed-to-use relations should not be circular (i.e., a lower layer cannot use a layer above).
Weaknesses:
– The addition of layers adds up-front cost and complexity to a system.
– Layers contribute a performance penalty.
• Both patterns support the structuring of software systems that feature human-computer interaction.
Adaptable Systems.
• This category includes
• The Reflection pattern
• the Microkernel pattern
• strongly support extension of applications and their adaptation to evolving technology and changing
functional requirements.
Implementation Steps
1. Define the abstraction criterion for grouping tasks into layers.
2. Determine the number of abstraction levels according to your abstraction criterion.
3. Name the layers and assign tasks to each of them.
4. Specify the services.
5. Refine the layering.
6. Specify an interface for each layer.
7. Structure individual layers.
8. Specify the communication between adjacent layers.
9. Decouple adjacent layers.
10. Design an error-handling strategy.
Known Usages:
Virtual Machines. We can speak of lower levels as a virtual machine that insulates higher levels from low-level details
or varying hardware. For example, the Java Virtual Machine (JVM) defines a binary code format. Code written in the
Java programming language is translated into a platform-neutral binary code, also called byte- codes, and delivered
to the JVM for interpretation. The JVM itself is platform-specific-there are implementations of the JVM for different
operating systems and processors. Such a two-step translation process allows platform-neutral source code and the
delivery of binary code not readable to humans1, while maintaining platform- independency.
APIs. An Application Programming Interface is a layer that encapsu- lates lower layers of frequently-used
functionality. An API is usually a flat collection of function specifications, such as the UNIX system calls. 'Flat' means
113 | P a g e Software Architecture
here that the system calls for accessing the UNIX file system. These libraries provide the benefit of portabil- ity
between different operating systems, and provide additional higher-level services such as output buffering or
formatted output. They often carry the liability of lower efficiency2, and perhaps more tightly-prescribed behavior,
whereas conventional system calls would give more flexibility-and more opportunities for errors and concep- tual
mismatches, mostly due to the wide gap between high-level application abstractions and low-level system calls.
Windows NT [Cus93]. This operating system is structured according to the Microkernel pattern (171). The NT
Executive component corresponds to the microkernel component of the Microkernel pattern. The NT Executive is a
Relaxed Layered System, as described in the Variants section. It has the following layers:
System services: the interface layer between the subsystems and the NT Executive.
2. Input/output buffering in Mgher layers is often intended to have the inverse effect-better performance than
undisciplined direct use of lower-level system calls.
@ Resource management layer: this contains the modules Object Manager, Security Reference Monitor, Process
Manager, 1/0 Manager, Virtual Memory Manager and Local Procedure Calls.
@ Kernel: this takes care of basic functions such as interrupt and ex- ception handling, multiprocessor
synchronization, thread schedu- ling and thread dispatching.
@ HAL (Hardware Abstraction Layer): this hides hardware differences between machines of different processor
families.
@ Hardware
Windows NT relaxes the principles of the Layers pattern because the Kernel and the 1/0 manager access the
underlying hardware directly for reasons of efficiency.
onsequences
Problem
• Imagine you are building a system that must process or transform a stream of input data. Implementing
such a system as a single component may not be feasible for several reasons:
• the system has to be built by several developers,
• the global system task decomposes naturally into several processing stages, and
• the requirements are likely to change.
• You therefore plan for future flexibility by exchanging or reordering the processing steps.
• By incorporating such flexibility, it is possible to build a family of systems using existing processing
components.
The design of the system-especially the interconnection of processing steps-has to consider the following forces:
• Future system enhancements should be possible by exchanging processing steps or by recombination of
steps, even by users.
• Small processing steps are easier to reuse in different contexts than large components. Non-adjacent
processing steps do not share information.
114 | P a g e Software Architecture
• Different sources of input data exist, such as a network connection or a hardware sensor providing
temperature readings, for example. It should be possible to present or store final results in various ways.
Explicit storage of intermediate results for further processing in files clutters directories and is error-prone, if
done by users.
• You may not want to rule out multi-processing the steps, for example running them in parallel or quasi-
parallel.
Solution
• The Pipes and Filters architectural pattern divides the task of a system into several sequential processing
steps.
• These steps are connected by the data flow through the system-the output data of a step is the input to the
subsequent step.
• Each processing step is implemented by a filter component.
• A filter consumes and delivers data incrementally-in contrast to consuming all its input before producing any
output-to achieve low latency and enable real parallel processing.
• The input to the system is provided by a data source such as a text file.
• The output flows into a data sink such as a file, terminal, animation program and so on.
• The data source, the filters and the data sink are connected sequentially by pipes.
• Each pipe implements the data flow between adjacent processing steps.
• The sequence of filters combined by pipes is called a processing pipeline.
Relations: The attachment relation associates the output of filters with the input of pipes and vice versa.
Constraints:
– Pipes connect filter output ports to filter input ports.
– Connected filters must agree on the type of data being passed along the connecting pipe.
Another Example
Implementation Steps
1. Divide the system's task into a sequence of processing stages.
2. Define the data format to be passed along each pipe.
3. Decide how to implement each pipe connection.
4. Design and implement the fiters.
5. Design the error handling.
6. Set up the processing pipeline.
– If your system handles a single task you can use a standardized main program that sets up the
pipeline and starts processing. This type of system may benefit from a direct- call pipeline, in which
the main program calls the active filter to start processing.
– You can increase flexibility by providing a shell or other end-user facility to set up various pipelines
from your set of filter components.
– Such a shell can support the incremental development of pipelines by allowing intermediate results
to be stored in files, and supporting files as pipeline input.
– You are not restricted to a text-only shell such as those provided by UNIX, and could even develop
a graphical environment for visual creation of pipelines using 'drag and drop' interaction.
Benefits
1. No intermediate files necessary, but possible.
2. Flexibility by filter exchange.
3. Flexibility by recombination.
4. Reuse of filter components.
5. Rapid prototyping of pipelines.
6. Egiciemy by parallel processing.
Liabilities
1. Sharing state information is expensive or inflxible.
2. Efficiency gain by parallel processing is often an illusion.
3. Data transformation overhead.
4. Error handling.
Black Board
Blackboard
• The Blackboard architectural pattern is useful for problems for which no deterministic solution strategies are
known.
• In Blackboard several specialized subsystems assemble their knowledge to build a possibly partial or
approximate solution.
• CONTEXT
• An immature domain in which no closed approach to a solution is known or feasible.
Problem
• The Blackboard pattern tackles problems that do not have a feasible deterministic solution for the
transformation of raw data into high-level data structures, such as diagrams, tables or English phrases.
• Vision, image recognition, speech recognition and surveillance are examples of domains in which such
problems occur.
• They are characterized by a problem that, when decomposed into sub-problems, spans several fields of
expertise.
• The solutions to the partial problems require different representations and paradigms.
• In many cases no predetermined strategy exists for how the 'partial problem solvers' should combine their
knowledge.
• This is in contrast to functional de-composition, in which several solution steps are arranged so that the
sequence of their activation is hard-coded.
117 | P a g e Software Architecture
Solution
• The idea behind the Blackboard architecture is a collection of independent programs that work cooperatively
on a common data structure.
• Each program is specialized for solving a particular part of the overall task, and all programs work together
on the solution.
• These specialized programs are independent of each other.
• They do not call each other, nor is there a predetermined sequence for their activation.
• Instead, the direction taken by the system is mainly determined by the current state of progress.
• A central control component evaluates the current state of processing and coordinates the specialized
programs.
• This data-directed control regime is referred to as opportunistic problem solving.
• It makes experimentation with different algorithms possible, and allows experimentally-derived heuristics to
control processing.
• During the problem-solving process the system works with partial solutions that are combined, changed or
rejected.
• Each of these solutions represents a partial problem and a certain stage of its solution.
• The set of all possible solutions is called the solution space, and is organized into levels of abstraction.
• The lowest level of solution consists of an internal representation of the input.
• Potential solutions of the overall system task are on the highest level.
• The name 'blackboard was chosen because it is reminiscent of the situation in which human experts sit in
front of a real blackboard and work together to solve a problem.
• Each expert separately evaluates the current state of the solution, and may go up to the blackboard at any
time and add, change or delete information.
• Humans usually decide themselves who has the next access to the blackboard.
• In the pattern we describe, a moderator component decides the order in which programs execute if more
than one can make a contribution.
Structure
• Divide your system into a component called blackboard, a collection of knowledge sources, and a control
component.
• The blackboard is the central data store. Elements of the solution space and control data are stored here.
• We use the term vocabulary for the set of all data elements that can appear on the blackboard.
• The blackboard provides an interface that enables all knowledge sources to read from and write to it.
• All elements of the solution space can appear on the blackboard.
• For solutions that are constructed during the problem solving process and put on the blackboard, we use the
terms hypothesis or blackboard entry.
• Hypotheses rejected later in the process are removed from the blackboard.
Components
• The blackboard can be viewed as a three-dimensional problem space with the time line for speech on the X-
axis, increasing levels of abstraction on the Y-axis and alternative solutions on the Z-axis
118 | P a g e Software Architecture
• Knowledge sources are separate, independent subsystems that solve specific aspects of the overall
problem. Together they model the overall problem domain. None of them can solve the task of the system
alone-a solution can only be built by integrating the results of several knowledge sources.
• The control component runs a loop that monitors the changes on the blackboard and decides what action to
take next. It schedules knowledge source evaluations and activations according to a knowledge application
strategy. The basis for this strategy is the data on the blackboard.
Structure
• A Blackboard system can be regarded as a radical extension of the original production system formalism:
arbitrary programs are allowed for both sides of the rules, and the internal complexity of the working
memory is increased.
• Complicated scheduling algorithms are used for conflict- resolution.
Variant: Repository.
• This variant is a generalization of the Blackboard pattern.
• The central data structure of this variant is called a repository.
• In a Blackboard architecture the current state of the central data structure, in conjunction with the Control
component, finally activates knowledge sources.
• In contrast, the Repository pattern does not specify an internal control.
• A repository architecture may be controlled by user input or by an external program.
• A traditional database, for example, can be considered as a repository.
• Application programs working on the database correspond to the knowledge sources in the Blackboard
architecture
Known Usages
HEARSAY-11.
• The first Blackboard system was the HEARSAY-I1 speech recognition system from the early 1970's. It was
developed as a natural language interface to a literature database.
HASP/SIAP.
• The HASP system was designed to detect enemy submarines. In this system, hydrophone arrays monitor a
sea area by collecting sonar signals.
CRYSALIS.
• This system was designed to infer the three-dimensional structure of protein molecules from X-ray diffraction
data
TRICERO.
• This system monitors aircraft activities
SUS: 'Software Understanding System
• In a matching process the system compares patterns from a pattern base to the system under analysis.
• SUS incrementally builds a 'pattern map' of the analyzed software that then can be viewed.
Distributed Systems
Broker - The Microkernel and Pipes and Filters patterns only consider distribution as a secondary concern and are
therefore listed under their respective primary categories.
Problem
• Building a complex software system as a set of decoupled and inter-operating components, rather than as a
monolithic application, results in greater flexibility, maintainability and changeability.
• By partitioning functionality into independent components the system becomes potentially distributable and
scalable.
• However, when distributed components communicate with each other, some means of inter-process
communication is required.
• If components handle communication themselves, the resulting system faces several dependencies and
limitations.
Example
• The system becomes dependent on the communication mechanism used, clients need to know the location
of servers, and in many cases the solution is limited to only one programming language.
• Services for adding, removing, exchanging, activating and locating components are also needed.
• Applications that use these services should not depend on system-specific details to guarantee portability
and interoperability, even within a heterogeneous network.
developer's viewpoint
• There should essentially be no difference between developing software for centralized systems and
developing for distributed ones.
• An application that uses an object should only see the interface offered by the object.
• It should not need to know anything about the implementation details of an object, or about its physical
location.
121 | P a g e Software Architecture
Solution
• Introduce a broker component to achieve better decoupling of clients and servers.
• Servers register themselves with the broker, and make their services available to clients through method
interfaces.
• Clients access the functionality of servers by sending requests via the broker.
• A broker's tasks include locating the appropriate server, forwarding the request to the server and
transmitting results and exceptions back to the client.
How it works
• The Broker pattern reduces the complexity involved in developing distributed applications, because it makes
distribution transparent to the developer.
• It achieves this goal by introducing an object model in which distributed services are encapsulated within
objects.
• Broker systems therefore offer a path to the integration of two core technologies:
• distribution and object technology.
• They also extend object models from single applications to distributed applications consisting of decoupled
components that can run on heterogeneous machines and that can be written in different programming
languages.
Structure
• The Broker architectural pattern comprises six types of participating components:
• Clients,
• servers,
• brokers,
• bridges,
• client-side proxies and
• server-side proxies.
Server
• A Server implements objects that expose their functionality through interfaces that consist of operations and
attributes.
• These interfaces are made available either through an interface definition language (IDL) or through a
binary standard.
• Interfaces typically group semantically-related functionality.
• There are two kinds of servers:
• Servers offering common services to many application domains.
• Servers implementing specific functionality for a single application domain or task.
122 | P a g e Software Architecture
CRC diagram
Server: Illustration
• WWW servers that provide access to HTML (Hypertext Markup Language) pages.
• WWW servers are implemented as http daemon processes (hypertext transfer protocol daemon) that wait
on specific ports for incoming requests.
• When a request arrives at the server, the requested document and any additional data is sent to the client
using data streams.
• The HTML pages contain documents as well as CGI (Common Gateway interface) scripts for remotely-
executed operations on the network host-the remote machine from which the client received the HTML-
page.
• A CGI script may be used to allow the user fill out a form and submit a query, for example a search request
for vacant hotel rooms.
• To display animations on the client's browser, Java 'applets' are integrated into the HTML documents.
• For example, one of these Java applets animates the route between one place and another on a city map.
• Java applets run on top of a virtual machine that is part of the WWW browser.
• CGI scripts and Java applets differ from each other: CGI scripts are executed on the server machine,
whereas Java applets are transferred to the WWW browser and then executed on the client machine.
Client
• Clients are applications that access the services of at least one server.
• To call remote services, clients forward requests to the broker.
• After an operation has executed they receive responses or exceptions from the broker.
• The interaction between clients and servers is based on a dynamic model, which means that servers may
also act as clients.
• This dynamic interaction model differs from the traditional notion of Client-Server computing in that the roles
of clients and servers are not statically defined.
• From the viewpoint of an implementation, you can consider clients as applications and servers as libraries-
though other implementations are possible.
• Note that clients do not need to know the location of the servers they access.
• This is important, because it allows the addition of new services and the movement of existing services to
other locations, even while the system is running.
123 | P a g e Software Architecture
CRC Diagram
Client: Illustration
• In the context of the Broker pattern, the clients are the available WWW browsers.
• They are not directly connected to the network. Instead, they rely on Internet providers that offer gateways
to the Internet, such as vsnl.
• WWW browsers connect to these workstations, using either a modem or a leased line.
• When connected they are able to retrieve data streams from httpd servers, interpret this data and initiate
actions such as the display of documents on the screen or the execution of Java applets.
Broker
• A broker is a messenger that is responsible for the transmission of requests from clients to servers, as well
as the transmission of responses and exceptions back to the client.
• A broker must have some means of locating the receiver of a request based on its unique system identifier.
A broker offers APIs (Application Programming Interfaces) to clients and servers that include operations for
registering servers and for invoking server methods.
• When a request arrives for a server that is maintained by the local broker, the broker passes the request
directly to the server.
• If the server is currently inactive, the broker activates it.
• All responses and exceptions from a service execution are forwarded by the broker to the client that sent the
request.
• If the specified server is hosted by another broker, the local broker finds a route to the remote broker and
forwards the request using this route.
• There is therefore a need for brokers to interoperate.
• Depending on the requirements of the whole system, additional services-such as name services or
marshalling services may be integrated into the broker.
124 | P a g e Software Architecture
CRC Diagram
Some Definitions
In this pattern description we distinguish between local and remote brokers.
A local broker is running on the machine currently under consideration.
A remote broker is running on a remote network node.
Name services provide associations between names and objects.
To resolve a name, a name service determines which server is associated with a given
name.
In the context of Broker systems, names are only meaningful relative to a name space.
Marshalling is the semantic-invariant conversion of data into a machine independent
format such as
ASN.1 (Abstract Syntax Notation or
ONC XDR [external Data Representation).
Marshalling performs the reverse transformation.
Broker: Illustration
• A broker may be a combination of an Internet gateway and the Internet infrastructure itself.
• Every information exchange between a client and a server must pass through the broker.
• A client specifies the information it wants using unique identifiers called URLs (Universal Resource
Locators).
• By using these identifiers the broker is able to locate the required services and to route the requests to the
appropriate server machines.
• When a new server machine is added, it must be registered with the broker.
• Clients and servers use the gateway of their Internet provider as an interface to the broker.
Client-side proxies
• Client-side proxies represent a layer between clients and the broker.
• This additional layer provides transparency, in that a remote object appears to the client as a local one.
• In detail, the proxies allow the hiding of implementation details from the clients such as:
• The inter-process communication mechanism used for message transfers between clients
and brokers.
• The creation and deletion of memory blocks.
• The marshalling of parameters and results.
• In many cases, client-side proxies translate the object model specified as part of the Broker architectural
pattern to the object model of the programming language used to implement the client.
125 | P a g e Software Architecture
CRC Diagram
CRC Diagram
Bridges
• Bridges are optional components used for hiding implementation details when two brokers interoperate.
• Suppose a Broker system runs on a heterogeneous network.
• If requests are transmitted over the network, different brokers have to communicate independently of the
different network and operating systems in use.
• A bridge builds a layer that encapsulates all these system-specific details.
126 | P a g e Software Architecture
CRC Diagram
Broker System
Implementation
1. Define an object model, or use an existing model
2. Decide which kind of component-interoperability the system should offer.
3. Specify the APIs the broker component provides for collaborating with clients and servers.
4. Use proxy objects to hide implementation details from clients and servers.
5. Design the broker component in parallel with steps 3 and 4. (Note the steps involved)
6. Develop IDL compilers.
Variants
• Direct Communication Broker System
• Message Passing Broker System
• Trader System
• Adapter Broker System
• Callback Broker System
Known Usages
*CORBA * IBM SOM/DSOM *Microsoft's OLE 2.x *World Wide Web *ATM-P.
Consequences: benefits
• Location Transparency
• Changeability and extensibility of components
• Portability of a Broker system
• Interoperability between dzflerent Broker systems.
• Reusability
• Testing and Debugging
Consequences: Liabilities
• Restricted efficiency
• Lower fault tolerance
• Testing and Debugging
127 | P a g e Software Architecture
Interactive Systems
• This category comprises two patterns,
• the Model-View-Controller pattern
(well-known from Smalltalk,)
• the Presentation-Abstraction-Control pattern.
• Both patterns support the structuring of software systems that feature human-computer interaction.
User Interaction
• Today's systems allow a high degree of user interaction, mainly achieved with help of graphical user
interfaces.
• The objective is to enhance the usability of an application.
• Usable software systems provide convenient access to their services, and therefore allow users to learn the
application and produce results quickly.
• When specifying the architecture of such systems, the challenge is to keep the functional core independent
of the user interface.
• The core of interactive systems is based on the functional requirements for the system, and usually remains
stable.
• User interfaces, however, are often subject to change and adaptation.
• For example, systems may have to support different user interface standards, customer-specific 'look and
feel' metaphors, or interfaces that must be adjusted to fit into a customer's business processes.
128 | P a g e Software Architecture
• This requires architectures that support the adaptation of user interface parts without causing major effects
to application-specific functionality or the data model underlying the software.
Model-View-Controller
• The MVC divides an interactive application into three components.
• The model contains the core functionality and data.
• Views display information to the user.
• Controllers handle user input.
• Views and controllers together comprise the user interface.
• A change-propagation mechanism ensures consistency between the user interface and the model.
Context
• Interactive applications with a flexible human-computer interface.
Problem
• User interfaces are especially prone to change requests. When you extend the functionality of an
application, you must modify menus to access these new functions.
• A customer may call for a specific user interface adaptation, or a system may need to be ported to another
platform with a different 'look and feel' standard.
• Even upgrading to a new release of your windowing system can imply code changes.
• The user interface platform of long-lived systems thus represents a moving target.
• Different users place conflicting requirements on the user interface.
• A typist enters information into forms via the keyboard.
• A manager wants to use the same system mainly by clicking icons and buttons.
• Consequently, support for several user interface paradigms should be easily incorporated.
• Building a system with the required flexibility is expensive and error-prone if the user interface is tightly
interwoven with the functional core.
• This can result in the need to develop and maintain several substantially different software systems, one for
each user interface implementation.
• Ensuing changes spread over many modules.
Influences
129 | P a g e Software Architecture
Solution
• Model-View-Controller (MVC] was first introduced in the Smalltalk-80 programming environment.
• MVC divides an interactive application into the three areas:
• processing,
• output, and
• input.
Model
• The model component encapsulates core data and functionality.
• The model is independent of specific output representations or input behaviour.
View
• View components display information to the user. A view obtains the data from the model.
• There can be multiple views of the model.
Controller
• Each view has an associated controller component.
• Controllers receive input, usually as events that encode mouse movement, activation of mouse buttons, or
keyboard input.
• Events are translated to service requests for the model or the view.
• The user interacts with the system solely through controllers.
MVC
• The separation of the model from view and controller components allows multiple views of the same model.
• If the user changes the model via the controller of one view, all other views dependent on this data should
reflect the changes.
• The model therefore notifies all views whenever its data changes.
• The views in turn retrieve new data from the model and update the displayed information.
• This change- propagation mechanism is described in the Publisher-Subscriber pattern
Structure: Model
• The model component contains the functional core of the application.
• It encapsulates the appropriate data, and exports procedures that perform application-specific processing.
• Controllers call these procedures on behalf of the user.
• The model also provides functions to access its data that are used by view components to acquire the data
to be displayed.
• The change-propagation mechanism maintains a registry of the dependent components within the model.
• All views and also selected controllers register their need to be informed about changes.
• Changes to the state of the model trigger the change-propagation mechanism.
• The change-propagation mechanism is the only link between the model and the views and controllers.
CRC Diagram
130 | P a g e Software Architecture
Structure: View
• View components present information to the user.
• Different views present the information of the model in different ways.
• Each view defines an update procedure that is activated by the change- propagation mechanism.
• When the update procedure is called, a view retrieves the current data values to be displayed from the
model, and puts them on the screen.
• During initialization all views are associated with the model, and register with the change-propagation
mechanism.
• Each view creates a suitable controller.
• There is a one-to-one relationship between views and controllers.
• Views often offer functionality that allows controllers to manipulate the display.
• This is useful for user-triggered operations that do not affect the model, such as scrolling.
CRC Diagram
Structure: Controller
• The controller components accept user input as events.
• How these events are delivered to a controller depends on the user interface platform.
• For simplicity, let us assume that each controller implements an event-handling procedure that is called for
each relevant event.
• Events are translated into requests for the model or the associated view.
• If the behaviour of a controller depends on the state of the model, the controller registers itself with the
change-propagation mechanism and implements an update procedure.
• For example, this is necessary when a change to the model enables or disables a menu entry.
CRC Diagram
131 | P a g e Software Architecture
Structure: C++
Implementation
1. Separate human-computer interaction from core functionality
2. Implement the change-propagation mechanism
3. Design and implement the views
4. Design and implement the controllers
5. Design and implement the view-controller relationship
6. Implement the set-up of MVC
7. Dynamic view creation
8. 'Pluggable controllers
9. Infrastructure for hierarchical views and controllers
10. Further decoupling from system dependencies
Variants
• Document-View
• This variant relaxes the separation of view and controller.
• In several GUI platforms, window display and event handling are closely interwoven.
• For example, the X Window System reports events relative to a window.
132 | P a g e Software Architecture
• You can combine the responsibilities of the view and the controller from MVC in a single
component by sacrificing exchangeability of controllers.
Known Usages
• Smalltalk
• The VisualWorks Smalltalk environment supports different 'look and feel' standards by
decoupling view and controllers via display and sensor classes
• MFC (Microsoft Foundation Class Library)
• The Document-View variant of the Model-View- Controller pattern is integrated in the
Visual C++ environment
• ET++
• Establishes 'look and feel' independence by defining a class Window port that
encapsulates the user interface platform dependencies, in the same way as do our display
and sensor classes. Uses document-view variant.
Consequences: Benefits
• Multiple views of the same model
• Synchronized views.
• 'Pluggable' views and controllers.
• Exchangeability of 'look and feel’.
• Framework Potential.
Consequences: Liabilities
• Increased complexity.
• Potential for excessive number of updates.
• Intimate connection between view and controller.
• Close coupling of views and controllers to a model.
• Inefficiency of data access in view.
• Inevitability of change to view and controller when porting.
• Difficulty of using MVC with modern user-interface took.
PAC: Presentation-Abstraction-Control
• The Presentation-Abstraction-Control architectural pattern (PAC) defines a structure for interactive software
systems in the form of a hierarchy of cooperating agents.
• Every agent is responsible for a specific aspect of the application's functionality and consists of three
components: presentation, abstraction, and control.
• This subdivision separates the human-computer interaction aspects of the agent from its functional core and
its communication with other agents
Context
• Development of an interactive application with the help of agents.
• In the context of this pattern an agent denotes an information-processing component that includes event
receivers and transmitters, data structures to maintain stale, and a processor that handles incoming events,
updates its own state, and that may produce new events.
• Agents can be as small as a single object, but also as complex as a complete software system.
• We use the terms agent and PAC agent as synonyms in this pattern description
Problem
• Interactive systems can often be viewed as a set of cooperating agents.
• Agents specialized in human-computer interaction accept user input and display data.
• Other agents maintain the data model of the system and offer functionality that operates on this data.
• Additional agents are responsible for diverse tasks such as error handling or communication with other
software systems.
133 | P a g e Software Architecture
• Besides this horizontal decomposition of system functionality, we often encounter a vertical decomposition.
Example
• Production planning systems (PPS) , for example, distinguish between production planning and the
execution of a previously specified production plan.
• For each of these tasks separate agents can be defined.
• In such an architecture of cooperating agents, each agent is specialized for a specific task, and all agents
together provide the system functionality.
• This architecture also captures both a horizontal and vertical decomposition.
Forces
• Agents often maintain their own state and data.
• For example, in a PPS system, the production planning and the actual production control may work
on different data models, one tuned for planning and simulation and one performance-optimized for
efficient production.
• However, individual agents must effectively cooperate to provide the overall task of the application.
• To achieve this, they need a mechanism for exchanging, data, messages, and events.
• Interactive agents provide their own user interface, since their respective human-computer interactions often
differ widely.
• For example, entering data into spreadsheets is done using keyboard input, while the manipulation
of graphical objects uses a pointing device.
• Systems evolve over time.
• Their presentation aspect is particularly prone to change.
• The use of graphics, and more recently, multi-media features, are examples of pervasive changes
to user interfaces.
• Changes to individual agents, or the extension of the system with new agents, should not affect the
whole system.
Solution
• Structure the interactive application as a tree-like hierarchy of PAC agents.
• There should be one top-level agent, several intermediate-level agents, and even more bottom-level agents.
• Every agent is responsible for a specific aspect of the application's functionality, and consists of three
components: presentation, abstraction, and control.
• The whole hierarchy reflects transitive dependencies between agents.
• Each agent depends on all higher-level agents up the hierarchy to the top-level agent.
Agents
• The agent's presentation component provides the visible behaviour of the PAC agent.
• Its abstraction component maintains the data model that underlies the agent, and provides functionality that
operates on this data.
• Its control component connects the presentation and abstraction components, and provides functionality
that allows the agent to communicate with other PAC agents.
• The bottom-level agents present these concepts to the user and support all operations that users can
perform on these agents, such as zooming or moving a chart.
CRC Diagrams
137 | P a g e Software Architecture
Implementation
1. Define a model of the application.
2. Define a general strategy for organizing the PAC hierarchy
3. Specify the top-level PAC agent.
4. Specify the bottom-level PAC agents
5. Specih bottom-level PAC agents for system services.
6. Specify intermediate-level PAC agents to compose lower-level PAC agents
7. Specify intermediate-level PAC agents to coordinate lower-level PAC agents.
8. Separate core functionality from human-computer interaction
9. Provide the external interface.
Variants
• Many large applications-especially interactive ones-are multi-user systems. Multi-tasking is thus a major
concern when designing such software systems.
Variants
• PAC agents as active objects
• PAC agents as processes.
Known Usages
• Network Traffic Management.
• Mobile Robot.
Consequences: benefits
• Separation of concerns
• Support for change and extension
• Support for multi-tasking
Consequences: Liabilities
• Increased system complexity.
• Complex control component
• Applicability.
• Pipe-and-Filter Pattern
• Client Server Pattern
• Peer-to-Peer Pattern
• SOA Pattern
• Publish Subscribe
• Shared Data Pattern
• Allocation Patterns
• Map-Reduce Pattern , Multi-tier Pattern
Relation Between Tactics and Patterns
Using tactics together
Summary
What is a Pattern?
An architectural pattern establishes a relationship between:
A context. A recurring, common situation in the world that gives rise to a problem.
A problem. The problem, appropriately generalized, that arises in the given context.
A solution. A successful architectural resolution to the problem, appropriately abstracted. The solution for a pattern is
determined and described by:
– A set of element types (for example, data repositories, processes, and objects)
– A set of interaction mechanisms or connectors (for example, method calls, events, or message
bus)
– A topological layout of the components
– A set of semantic constraints covering topology, element behavior, and interaction mechanisms
Layer Pattern
Context: All complex systems experience the need to develop and evolve portions of the system independently. For
this reason the developers of the system need a clear and well-documented separation of concerns, so that modules
of the system may be independently developed and maintained.
Problem: The software needs to be segmented in such a way that the modules can be developed and evolved
separately with little interaction among the parts, supporting portability, modifiability, and reuse.
Solution: To achieve this separation of concerns, the layered pattern divides the software into units called layers.
Each layer is a grouping of modules that offers a cohesive set of services. The usage must be unidirectional. Layers
completely partition a set of software, and each partition is exposed through a public interface.
Layer Pattern Example
Weaknesses:
– The addition of layers adds up-front cost and complexity to a system.
– Layers contribute a performance penalty.
Broker Pattern
Context: Many systems are constructed from a collection of services distributed across multiple servers.
Implementing these systems is complex because you need to worry about how the systems will interoperate—how
they will connect to each other and how they will exchange information—as well as the availability of the component
services.
Problem: How do we structure distributed software so that service users do not need to know the nature and location
of service providers, making it easy to dynamically change the bindings between users and providers?
Solution: The broker pattern separates users of services (clients) from providers of services (servers) by inserting an
intermediary, called a broker. When a client needs a service, it queries a broker via a service interface. The broker
then forwards the client’s service request to a server, which processes the request.
Broker Example
141 | P a g e Software Architecture
Broker Solution – 1
Overview: The broker pattern defines a runtime component, called a broker, that mediates the communication
between a number of clients and servers.
Elements:
– Client, a requester of services
– Server, a provider of services
– Broker, an intermediary that locates an appropriate server to fulfill a client’s request, forwards the
request to the server, and returns the results to the client
– Client-side proxy, an intermediary that manages the actual communication with the broker,
including marshaling, sending, and unmarshaling of messages
– Server-side proxy, an intermediary that manages the actual communication with the broker,
including marshaling, sending, and unmarshaling of messages
Broker Solution - 2
Relations: The attachment relation associates clients (and, optionally, client-side proxies) and servers (and,
optionally, server-side proxies) with brokers.
Constraints: The client can only attach to a broker (potentially via a client-side proxy). The server can only attach to a
broker (potentially via a server-side proxy).
Weaknesses:
– Brokers add a layer of indirection, and hence latency, between clients and servers, and that layer
may be a communication bottleneck.
– The broker can be a single point of failure.
– A broker adds up-front complexity.
– A broker may be a target for security attacks.
– A broker may be difficult to test.
– Connected filters must agree on the type of data being passed along the connecting pipe.
143 | P a g e Software Architecture
MVC Example
144 | P a g e Software Architecture
MVC Solution - 1
Overview: The MVC pattern breaks system functionality into three components: a model, a view, and a controller that
mediates between the model and the view.
Elements:
– The model is a representation of the application data or state, and it contains (or provides an
interface to) application logic.
– The view is a user interface component that either produces a representation of the model for the
user or allows for some form of user input, or both.
– The controller manages the interaction between the model and the view, translating user actions
into changes to the model or changes to the view.
MVC Solution - 2
Relations: The notifies relation connects instances of model, view, and controller, notifying elements of relevant state
changes.
Constraints:
– There must be at least one instance each of model, view, and controller.
– The model component should not interact directly with the controller.
Weaknesses:
– The complexity may not be worth it for simple user interfaces.
– The model, view, and controller abstractions may not be good fits for some user interface toolkits.
Adaptable Systems.
Adaptable
• Systems evolve over time
• -new functionality is added and existing services are changed.
147 | P a g e Software Architecture
Context
The development of several applications that use similar programming interfaces that build on the same core
functionality.
Problem
• Developing software for an application domain that needs to cope with a broad spectrum of similar
standards and technologies is a non-trivial task.
• Well-known examples are application platforms such as operating systems and graphical user interfaces.
FORCES
• The application platform must cope with continuous hardware and software evolution.
• The application platform should be portable, extensible and adaptable to allow easy integration of emerging
technologies
• The applications in your domain need to support different, but similar, application platforms.
• The applications may be categorized into groups that use the same functional core in different ways,
requiring the underlying application platform to emulate existing standards.
• The functional core of the application platform should be separated into a component with minimal memory
size, and services that consume as little processing power as possible.
Solution
• Encapsulate the fundamental services of your application platform in a microkernel component.
• The microkernel includes functionality that enables other components running in separate processes to
communicate with each other.
• It is also responsible for maintaining system- wide resources such as files or processes.
• In addition, it provides interfaces that enable other components to access its functionality.
Solution - details
• Core functionality that cannot be implemented within the microkernel without unnecessarily increasing its
size or complexity should be separated in internal servers.
• External servers implement their own view of the underlying microkernel.
• To construct this view, they use the mechanisms available through the interfaces of the microkernel. Every
external server is a separate process that itself represents an application platform.
148 | P a g e Software Architecture
• Hence, a Microkernel system may be viewed as an application platform that integrates other application
platforms.
• Clients communicate with external servers by using the communication facilities provided by the
microkernel.
Structure
The Microkernel pattern defines five kinds of participating components:
• Internal servers
• External servers
• Adapters
• Clients
• Microkernel
Microkernel
• represents the main component of the pattern.
• It implements central services such as communication facilities or resource handling.
• Other components build on all or some of these basic services.
• They do this indirectly by using one or more interfaces that comprise the functionality exposed by the
microkernel.
Microkernel Component
• A microkernel implements atomic services,
which we refer to as mechanisms.
• These mechanisms serve as a fundamental
base on which more complex functionality,
called policies, are constructed.
• The microkernel is also responsible for
maintaining system resources such as
processes or files.
• It controls and coordinates the access to these
resources.
OMT Diagram
Implementation
1. Analyze the application domain.
2. Analyze external servers
3. Categorize the services.
4. Partition the categories.
5. Find a consistent and complete set of operatims and abstractims for every category.
6. Determine strategies for request transmission and retrieval.
7. Structure the microkernel component.
8. specify the programming interface
9. The microkernel is responsible for managing all system resources such as memory blocks, devices or
device contexts-a handle to an output area in a graphical user interface implementation.
10. Design and implement the internal servers as separate processes or shared libraries.
11. Implement the external servers
12. Implement the adapters
13. Develop client applications or use existing ones for the ready-to-run Microkernel system
Variant: Microkernel System with indirect Client-Server connections.
• A client that wants to send a request or message to an external server asks the microkernel for a
communication channel.
• After the requested communication path has been established, client and server communicate with each
other indirectly using the microkernel as a message backbone.
• Using this variant leads to an architecture in which all requests pass through the microkernel.
• You can apply it, for example, when security requirements force the system to control all communication
between participants.
Liability
1. Performance.
2. Complexity of design and implementation.
Context
• Building systems that support their own modification a priori.
Problem
• Software systems evolve over time.
• They must be open to modifications in response to changing technology and requirements.
• Designing a system that meets a wide range of different requirements a priori can be an overwhelming task.
• A better solution is to specify an architecture that is open to modification and extension.
• The resulting system can then be adapted to changing requirements on demand.
• In other words, we want to design for change and evolution.
Forces
• Changing software is tedious, error prone, and often expensive.
• Adaptable software systems usually have a complex inner structure.
• The more techniques that are necessary for keeping a system changeable, such as parameterization,
subclassing, mix-ins, or even copy and paste, the more awkward and complex its modification becomes.
• Changes can be of any scale, from providing shortcuts for commonly-used commands to adapting an
application framework for a specific customer.
• Even fundamental aspects of software systems can change, for example the communication mechanisms
between components.
Solution
• Make the software self-aware, and make selected aspects of its structure and behaviour accessible for
adaptation and change.
• This leads to an architecture that is split into two major parts:
• a meta level and
• a base level.
Meta Level
• The meta level provides a self-representation of the software to give it knowledge of its own structure and
behavior, and consists of so-called rnetaobjects.
• Metaobjects encapsulate and represent information about the software.
• Examples include type structures, algorithms, or even function call mechanisms.
Base Level
• The base level defines the application logic.
• Its implementation uses the metaobjects to remain independent of those aspects that are likely to change.
152 | P a g e Software Architecture
• For example, base-level components may only communicate with each other via a metaobject that
implements a specific user-defined function call mechanism.
• Changing this metaobject changes the way in which base-level components communicate, but without
modifing the base-level code.
Structure
OMT Diagram
• Since the base-level implementation explicitly builds upon information and services provided by
metaobjects, changing them has an immediate effect on the subsequent behaviour of the base level.
• The general structure of a reflective architecture is very much like a Layered system
153 | P a g e Software Architecture
154 | P a g e Software Architecture
Implementation
1. Define a model of the application.
2. Identify varying behavior
3. Identify structural aspects of the system, which, when changed, should not affect the implementation of the
base level
4. Identify system services that support both the variation of application services and the independence of
structural details
5. Define the metaobjects.
6. Define the metaobject protocol.
7. Define the base level.
Benefits
1. No explicit modification of source code.
2. Changing a software system is easy
3. Support for many kinds of change
Liabilities
1. Modifications at the meta level may cause damage
2. Increased number of components
3. Lower efficiency.
4. Not all potential changes to the software are supported.
5. Not all languages support refection.
Client-Server Example
155 | P a g e Software Architecture
Client-Server Solution - 1
Overview: Clients initiate interactions with servers, invoking services as needed from those servers and waiting for
the results of those requests.
Elements:
– Client, a component that invokes services of a server component. Clients have ports that describe
the services they require.
– Server: a component that provides services to clients. Servers have ports that describe the
services they provide.
Request/reply connector: a data connector employing a request/reply protocol, used by a client to invoke services on
a server. Important characteristics include whether the calls are local or remote, and whether data is encrypted.
Client-Server Solution- 2
Relations: The attachment relation associates clients with servers.
Constraints:
– Clients are connected to servers through request/reply connectors.
– Server components can be clients to other servers.
Weaknesses:
– Server can be a performance bottleneck.
– Server can be a single point of failure.
– Decisions about where to locate functionality (in the client or in the server) are often complex and
costly to change after a system has been built.
Peer-to-Peer Pattern
Context: Distributed computational entities—each of which is considered equally important in terms of initiating an
interaction and each of which provides its own resources—need to cooperate and collaborate to provide a service to
a distributed community of users.
Problem: How can a set of “equal” distributed computational entities be connected to each other via a common
protocol so that they can organize and share their services with high availability and scalability?
Solution: In the peer-to-peer (P2P) pattern, components directly interact as peers. All peers are “equal” and no peer
or group of peers can be critical for the health of the system. Peer-to-peer communication is typically a request/reply
interaction without the asymmetry found in the client-server pattern.
Peer-to-Peer Example
156 | P a g e Software Architecture
Peer-to-Peer Solution - 1
Overview: Computation is achieved by cooperating peers that request service from and provide services to one
another across a network.
Elements:
– Peer, which is an independent component running on a network node. Special peer components
can provide routing, indexing, and peer search capability.
– Request/reply connector, which is used to connect to the peer network, search for other peers, and
invoke services from other peers. In some cases, the need for a reply is done away with.
Relations: The relation associates peers with their connectors. Attachments may change at runtime.
Peer-to-Peer Solution - 2
Constraints: Restrictions may be placed on the following:
– The number of allowable attachments to any given peer
– The number of hops used for searching for a peer
– Which peers know about which other peers
– Some P2P networks are organized with star topologies, in which peers only connect to
supernodes.
Weaknesses:
– Managing security, data consistency, data/service availability, backup, and recovery are all more
complex.
– Small peer-to-peer systems may not be able to consistently achieve quality goals such as
performance and availability.
Publish-Subscribe Pattern
Context: There are a number of independent producers and consumers of data that must interact. The precise
number and nature of the data producers and consumers are not predetermined or fixed, nor is the data that they
share.
Problem: How can we create integration mechanisms that support the ability to transmit messages among the
producers and consumers so they are unaware of each other’s identity, or potentially even their existence?
Solution: In the publish-subscribe pattern, components interact via announced messages, or events. Components
may subscribe to a set of events. Publisher components place events on the bus by announcing them; the connector
then delivers those events to the subscriber components that have registered an interest in those events.
157 | P a g e Software Architecture
Publish-Subscribe Example
Publish-Subscribe Solution – 1
Overview: Components publish and subscribe to events. When an event is announced by a component, the
connector infrastructure dispatches the event to all registered subscribers.
Elements:
– Any C&C component with at least one publish or subscribe port.
– The publish-subscribe connector, which will have announce and listen roles for components that
wish to publish and subscribe to events.
Relations: The attachment relation associates components with the publish-subscribe connector by prescribing which
components announce events and which components are registered to receive events.
Publish-Subscribe Solution - 2
Constraints: All components are connected to an event distributor that may be viewed as either a bus—connector—
or a component. Publish ports are attached to announce roles and subscribe ports are attached to listen roles.
Weaknesses:
– Typically increases latency and has a negative effect on scalability and predictability of message
delivery time.
– Less control over ordering of messages, and delivery of messages is not guaranteed.
Shared-Data Pattern
Context: Various computational components need to share and manipulate large amounts of data. This data does not
belong solely to any one of those components.
Problem: How can systems store and manipulate persistent data that is accessed by multiple independent
components?
Solution: In the shared-data pattern, interaction is dominated by the exchange of persistent data between multiple
data accessors and at least one shared-data store. Exchange may be initiated by the accessors or the data store.
The connector type is data reading and writing.
Map-Reduce Example
160 | P a g e Software Architecture
161 | P a g e Software Architecture
Map-Reduce Solution - 1
Overview: The map-reduce pattern provides a framework for analyzing a large distributed set of data that will execute
in parallel, on a set of processors. This parallelization allows for low latency and high availability. The map performs
the extract and transform portions of the analysis and the reduce performs the loading of the results.
Elements:
– Map is a function with multiple instances deployed across multiple processors that performs the
extract and transformation portions of the analysis.
– Reduce is a function that may be deployed as a single instance or as multiple instances across
processors to perform the load portion of extract-transform-load.
– The infrastructure is the framework responsible for deploying map and reduce instances,
shepherding the data between them, and detecting and recovering from failure.
Map-Reduce Solution - 2
Relations:
– Deploy on is the relation between an instance of a map or reduce function and the processor onto
which it is installed.
– Instantiate, monitor, and control is the relation between the infrastructure and the instances of map
and reduce.
Constraints:
– The data to be analyzed must exist as a set of files.
– Map functions are stateless and do not communicate with each other.
– The only communication between map reduce instances is the data emitted from the map
instances as <key, value> pairs.
Weaknesses:
– If you do not have large data sets, the overhead of map-reduce is not justified.
– If you cannot divide your data set into similar sized subsets, the advantages of parallelism are lost.
– Operations that require multiple reduces are complex to orchestrate.
Multi-Tier Pattern
Context: In a distributed deployment, there is often a need to distribute a system’s infrastructure into distinct subsets.
Problem: How can we split the system into a number of computationally independent execution structures—groups of
software and hardware—connected by some communications media?
Solution: The execution structures of many systems are organized as a set of logical groupings of components. Each
grouping is termed a tier.
Multi-Tier Example
162 | P a g e Software Architecture
Multi-Tier Solution
Overview: The execution structures of many systems are organized as a set of logical groupings of components.
Each grouping is termed a tier.
Elements:
– Tier, which is a logical grouping of software components.
Relations:
– Is part of, to group components into tiers.
– Communicates with, to show how tiers and the components they contain interact with each other.
– Allocated to, in the case that tiers map to computing platforms.
Constraints: A software component belongs to exactly one tier.
Weaknesses: Substantial up-front cost and complexity.
Summary
An architectural pattern
– is a package of design decisions that is found repeatedly in practice,
– has known properties that permit reuse, and
– describes a class of architectures.
Tactics are simpler than patterns
Patterns are underspecified with respect to real systems so they have to be augmented with tactics.
– Augmentation ends when requirements for a specific system are satisfied.
166 | P a g e Software Architecture
Deployment Models
• Private cloud. The cloud infrastructure is owned solely by a single organization and operated solely for
applications owned by that organization.
• Public cloud. The cloud infrastructure is made available to the general public or a large industry group and is
owned by an organization selling cloud services.
• Community cloud. The cloud infrastructure is shared by several organizations and supports a specific
community that has shared concerns.
• Hybrid cloud. The cloud infrastructure is a composition of two or more clouds (private, community, or public)
that remain unique entities.
Economic Justification
• Economies of scale
• Utilization of equipment
• Multi-tenancy
Economies of Scale
• Large data centers are cheaper to operate (per unit measure) than small data centers.
• Large in this context means 100,000+ servers
• Small in this context means <10,000 servers.
167 | P a g e Software Architecture
Utilization of Equipment
• Use of virtualization technology allows for easy co-location of distinct applications and their associated
operating systems on the same server hardware. The effect of this co-location is to increase the utilization of
servers.
• Variations in workload can be managed to increase utilization.
– Random access. End users may access applications randomly. The more likely that the
randomness of their accesses will end up imposing a uniform load on the server.
• Time of day.
– Co-locate those services that are workplace related with those that are consumer related.
– Consider time differences among geographically distinct locations.
• Time of year. Consider yearly fluctuations in demand.
– Holidays, tax preparation season
• Resource usage patterns. Co-locate heavier CPU services with heavier I/O services.
• Uncertainty. Consider spikes in usage.
– news events, marketing events, sporting events
Multi-tenancy
• Some applications such as salesforce.com use a single application for multiple different consumers.
• This reduces costs by reducing costs of
– Help desk support
– Upgrade once, simultaneously, for all consumers
– Single version of the software from a development and maintenance perspective.
Summary
• The cloud provides a new platform for applications with some different characteristics.
Basic Mechanisms
168 | P a g e Software Architecture
• Hypervisor
• Virtual Machine
• File system
• Network
169 | P a g e Software Architecture
Virtual Machine
• A virtual machine has an address space isolated from any other virtual machine.
• Looks like a bare metal machine from the application perspective.
• Assigned an IP address and has network capability.
• Can be loaded with any operating system or applications that can execute on the processor of the host
machine.
170 | P a g e Software Architecture
File System
• Each virtual machine has access to a file system.
• We will present HDFS (Hadoop Distributed File System) – a widely used open source cloud file system.
• We describe how HDFS uses redundancy to ensure availability.
HDFS Components
Network
• Every Virtual Machine is assigned an IP address.
171 | P a g e Software Architecture
IaaS
• An arrangement of servers that manages the base technologies.
– Servers are arranged in clusters
– May be thousands of servers in a cluster
– Some servers are used as the infrastructure of the IaaS
– Every server has a hypervisor as its base.
IaaS Architecture
PaaS
• Provides an integrated stack for developer.
• E.g. LAMP stack
– Linux, Apache, MySQL, Python
• The developer writes code in Python and the PaaS manages assignment to underlying layers of the stack.
172 | P a g e Software Architecture
Databases
• Why relational databases came into question
– Massive amounts of data are collected from web systems. Much of this data is processed
sequentially and so RDBMSs introduce overhead, especially during creation and maintenance.
– The CAP Theorem shows that it is not possible to simultaneously achieve consistency, availability,
and partitioning.
– The relational model is not the best model for some applications.
• Caused the introduction of new data models
– Key-value
– Document centric
Security
• Multi-tenancy introduces additional concerns over non-cloud environments.
– Inadvertent information sharing. Possible that information may be shared because of shared use of
resources. E.g. information on a disk may remain if the disk is reallocated.
– A virtual machine “escape”. One user can break the hypervisor. So far, purely academic.
– Side channel attacks. One user can detect information through monitoring cache, for example.
Again, so far, purely academic.
– Denial of Service attacks. One users can consume resources and deny them to other users.
• Organizations need to consider risks when deciding what applications to host in the cloud.
Performance
• Auto-scaling provides additional performance when load grows.
– Response time for new resources may not be adequate
– Architects need to be aware of resource requirements for applications
173 | P a g e Software Architecture
Availability
• Failure is a common occurrence in the cloud
– With 1000s of servers, failure is to be expected
• Cloud providers ensure that the cloud itself will remain available with some notable exceptions.
• Application developers must assume instances will fail and build in detection and correction mechanisms in
case of failure.
Summary
• The cloud provides a new platform for applications with some different characteristics.
• Architect needs to know how a cloud cluster works and pay special attention to
– Security
– Performance
– Availability
Solution: The service-oriented architecture (SOA) pattern describes a collection of distributed components that
provide and/or consume services.
Relations: Attachment of the different kinds of components available to the respective connectors
Constraints: Service consumers are connected to service providers, but intermediary components (e.g., ESB,
registry, orchestration server) may be used.
Weaknesses:
– SOA-based systems are typically complex to build.
– You don’t control the evolution of independent services.
– There is a performance overhead associated with the middleware, and services may be
performance bottlenecks, and typically do not provide performance guarantees.
Key Challenges
• Many enterprises have failed to achieve success with cloud computing, because they failed to develop a
cloud strategy rooted in the definition and delivery of IT services linked to business outcomes.
• Many companies are unsure how to initiate their cloud projects, which could cause them to miss chances to
capitalize on business opportunities.
Recommendations
• Identify the cloud-computing-related IT services you will offer or procure.
• Document the internal processes that will be affected by the identified cloud services.
• Map applications and workloads to the associated cloud services.
CAP Theorem
• Described the trade-offs involved in distributed system
• It is impossible for a web service to provide following three guarantees at the same time:
• Consistency
• Availability
177 | P a g e Software Architecture
• Partition-tolerance
Consistency:
– All nodes should see the same data at the same time
Availability:
– Node failures do not prevent survivors from continuing to operate
Partition-tolerance:
– The system continues to operate despite network partitions
• A distributed system can satisfy any two of these guarantees at the same time but not all three
Not Consistent
• Data A is being read a node in one partition.
• Data B is being written into a node another partition.
• This assures:
Availability:
– Node failures do not prevent survivors from continuing to operate
Partition-tolerance:
– The system continues to operate despite network partitions
Not Available
• Data A in one partition is locked while….
• Data B is being written into a node another partition.
• This assures:
Consistency:
– All nodes should see the same data at the same time
Partition-tolerance:
– The system continues to operate despite network partitions
Hybrid app
• A hybrid app combines elements of both native apps and web applications.
• Examples: Twitter, Uber, Instagram
• Hybrid apps are essentially web apps (HTML, CSS, Javascript) that have been put in a native app shell.
179 | P a g e Software Architecture
• The shell is able to connect to native capabilities of the mobile platform such as camera, accelerometer,
GPS, etc.
• Tools such as Xamarin and React Native allows app to run across platforms
Responsive design
Single website for laptop & mobile & tablet
Principle: Adapt rendering depending on screen sizes & orientation
180 | P a g e Software Architecture
Technique
• Use CSS and HTML to shrink, hide
or move content
• Flexible grids (CSS 3)
– Use media queries to
determine screen size
– Specify grid width as % of
screen size rather than
fixed pixels
• Flexible images – Specify image
size as % of grid size
Examples of components
Activity & Content providers (Background) Service
Review questions
Mobile apps
1. What is a cross platform mobile app?
2. If connectivity is poor, how do we ensure consistency between data in mobile phone and backend server?
3. What is ‘Broadcast receiver’ in an Android app?
182 | P a g e Software Architecture
Tizen Architecture
Android Stack
183 | P a g e Software Architecture
Android comes with a set of core apps for email, SMS messaging, calendars, internet browsing, contacts,
and more.
Apps included with the platform have no special status among the apps the user chooses to install.
So, a third-party app can become the user's default web browser, SMS messenger, or even the default
keyboard (some exceptions apply, such as the system's Settings app).
Linux Kernel
185 | P a g e Software Architecture
Android Architecture
Context diagram
Higher degrees of multi-tenancy are best suited for cross-industry utilitarian workloads such as e-mail, expense
reporting, travel authorization and sales force management.
These applications can very easily share the same schema.
Degree of multi-tenancy
• Highest degree: IaaS and PaaS are multi-tenant. SaaS is fully multi-tenant also.
• Middle degree: IaaS and PaaS are multi-tenant. Small SaaS clusters are multi-tenant.
• Lowest degree: IaaS and PaaS are multi-tenant. SaaS is single tenant.
Exercise
When would you use the following options:
a) App 1
Web tier – Multi-tenant
App tier – Single tenant
Data tier – Multi-tenant
b) App 2
Web tier – Single tenant
App tier – Multi-tenant
Data tier – Single tenant
Google search
Do you know how Google Search works?
3 steps:
• Catalog & index: Even before you search, Google goes through various web sites and linked web sites
(crawling) and catalogs all the web sites. This runs into several Tera bytes.
• Understand & enrich your query: Correct spelling mistakes, consider synonyms, etc.
• Search: When the search is requested, it uses this catalog to determine which web sites closely match the
requirement. For this it uses a ‘Page Rank’ (named after Larry Page) algorithm which considers factors such
as which page has max number of occurrences of the search string, how many other web sites refer to this
web site, what is the reputation of the websites that refer to this website, etc.
Google BigTable
Google BigTable is a wide table containing several attributes of a website;
Here are some attributes:
• The contents of Web page
• Anchor text*
• Websites referencing the page.
• Time stamp when the data was stored
Google BigTable is built on technologies like Google File System (GFS)
Google BigTable is used by applications such as Google Maps, Google Analytics, etc.
– IT Services and BPO companies analyze the call records/logs to gain insights into customer
complaints and feedback, call center executive response/ability to resolve the ticket, and to
improve the overall quality of service.
– Call center data from telecommunications industries can be used to analyze the call records/logs
and optimize the price, and calling plan, messaging plan, and data plans
Industrial equipment monitoring & alerting
– A large power plant or chemical factory has thousands of critical equipment that needs to be
monitored
– The equipment data needs to be analysed to detect any malfunctioning or danger of accidents
Weather forecasting
– Satellite data from remote sensing satellites need to be analysed at high speed to warn fishermen,
farmers and public about potential cyclones, delayed monsoon, etc.
Hadoop
Hadoop is an open source framework, from the Apache foundation, capable of processing large amounts of
heterogeneous data sets in a distributed fashion across clusters of commodity computers and hardware using a
simplified programming model.
Hadoop provides a reliable shared storage and analysis system.
Components of Hadoop
HDFS (Hadoop Distributed File System)
• HDFS offers a highly reliable and distributed storage, and ensures reliability, even on a commodity
hardware, by replicating the data across multiple nodes.
• Unlike a regular file system, when data is pushed to HDFS, it will automatically split into multiple
blocks (configurable parameter) and stores/replicates the data across various data nodes. This
ensures high availability and fault tolerance.
MapReduce
• MapReduce offers an analysis system which can perform complex computations on large datasets.
195 | P a g e Software Architecture
• This component is responsible for performing all the computations and works by breaking down a
large complex computation into multiple tasks and assigns those to individual worker/slave nodes
and takes care of coordination and consolidation of results
Hadoop - HDFS
Data
• Large files are broken down into blocks (128 MB usually) and spread across Data nodes.
• Data blocks are replicated and Degree of replication can be adjusted
Meta data
• Name node stores meta data – data about files, distribution of data (which block is in which nodes),
etc.
• For good performance, all the metadata is loaded into the physical memory of the NameNode
server.
Features
• Data nodes provide Heart beat messages to Name node
• Supports data pipelines. A connection between data nodes to move data from one node to another
• Rebalancer: Balances distribution of data
Map-Reduce pattern
• Used to analyse vast amount of data
• Suppose we keep track of every click of the user on a web site and store these details in a database
• Let us say we want to find out the average time spent by users on each web page of the web site, across
thousands of users who visited the web site in the last 30 days
• How can we speed up the analysis?
Map-Reduce pattern
• Example: Determine the average time (duration) spent by users on different web pages
• Step 1: Map processes data on each node are outputs <Web page, (Avg time, # of users)>
• Step 2: Reduce produces <Web page, weighted Avg time>
Experience Sharing
Have you come across systems that use this pattern?
Hadoop - HDFS
Features
• Can store peta bytes of data , Distributed, Replicated, Fault tolerant (self healing)
Using Hadoop
When to Use Hadoop (Hadoop Use Cases)
Hadoop can be used in various scenarios including some of the following:
• Analytics
• Search
• Data Retention
• Log file processing
• Analysis of Text, Image, Audio, & Video content
• Recommendation systems like in E-Commerce Websites
When Not to Use Hadoop
There are few scenarios in which Hadoop is not the right fit. Following are some of them:
• Low-latency or near real-time data access.
• If you have a large number of small files to be processed. This is due to the way Hadoop works.
Namenode holds the file system metadata in memory and as the number of files increases, the
amount of memory required to hold the metadata increases.
• Multiple writes scenario or scenarios requiring arbitrary writes or writes between the files.
• If we can retrieve disk data into memory and then use it for further processing, we can get even better
response time
Apache Spark
• Apache Spark is open source, general-purpose distributed computing engine used for processing and
analyzing a large amount of data
• Main feature: In-memory cluster computing
• Useful for real time computations
Spark architecture
199 | P a g e Software Architecture
NoSQL - Flexibility
202 | P a g e Software Architecture
NoSQL - Simplicity
203 | P a g e Software Architecture
Document DB vs Relational DB
Good for
• Ecommerce platform
• Content management
systems
Features of Mongo DB
• Indexing
• Ad hoc search
• Replication
• Partitioning / Sharding
• Ex. Partition data by Product or Geography
204 | P a g e Software Architecture
Key-Value database
• Data model is Key value pair
• Uses hashing for fast access
• The DB does not care what is contained in the value
• Example scenarios: Phone directory, Stock trading
• Some of the popular key-value databases
are Riak, Redis (often referred to as Data Structure
server), Memcached and its flavors, Berkeley
DB, upscaledb (especially suited for embedded use),
Amazon DynamoDB (not open-source), Project Voldemort
and Couchbase.
Uses of Redis
• Session cache, with persistence
Graph database
Entities and relationships have properties (attributes)
Ex.
– Eifel tower properties can be height, date of construction
– Visited relationship can have properties such as date of visit
Uses
• Store a large amount of inter-related information and to search for an entity along with its relationships
• Fraud detection
• Social networks
Graph database
• Graph databases allow you to store entities and relationships between these entities.
• Entities are also known as nodes, which have properties. Think of a node as an instance of an object in the
application.
• Relations are known as edges that can have properties. Edges have directional significance; nodes are
organized by relationships which allow you to find interesting patterns between the nodes.
• There are many graph databases available, such as Neo4J, Infinite Graph, OrientDB, or FlockDB
In-Memory databases
• An in-memory database (IMDB; also main memory database system or MMDB or memory resident
database) is a database management system that primarily relies on main memory
• Applications where response time is critical, such as those running telecommunications network equipment
and mobile advertising networks, often use main-memory databases
• With the introduction of non-volatile random access memory technology (Flash memory), in-memory
databases will be able to run at full speed and maintain data in the event of power failure
• Popular In-memory databases are SAP’s HANA, IBM DB2 BLU, Oracle
• These databases support OLTP and OLAP (Online Analytical Processing)
207 | P a g e Software Architecture
208 | P a g e Software Architecture
Real-time analytics
Detecting bank fraud requires real-time analytics as events happen
Such situations demand processing of each event as they happen rather processing a batch of data on disk
This led to tools such as Spark Streams and Storm which support in-memory processing, than disk based processing
Storm topology
Kafka is a distributed and robust queue that can handle high volume data and enables you to pass messages from
one end-point to another (Publish - Subscribe)
212 | P a g e Software Architecture
Introduction – The objective of this session is to provide an introduction to a few important technology topics.
Transport layer security (TLS) (Older version is SSL)
• Used for secure communication between client & server (example between browser and a web site)
• It provides
• Privacy: No intruder can know what communication is going on
• Data integrity: Data being communicated can not be modified by an intruder. If he does, it can be
detected
OpenID
• We use several websites.
• One issue we face is, remembering user ids & passwords of several websites
• With OpenID technology, we can use a single account, such as Facebook, Google or Yahoo, to sign-in to
thousands of websites
OAuth
OpenID is to authenticate users.
OAuth authorizes a client to access your data stored in another website such as Yahoo (data such as your profile,
contacts in Yahoo)
LDAP
• LDAP is an Internet protocol to talk to a Directory service such as Active Directory of Microsoft
• Directory services store information in a tree structure
• LDAP is used in many open source solutions such as Docker, Kubernetes, Jenkins, etc.
Firewall
• A firewall is a network security device that monitors incoming and outgoing network traffic and decides
whether to allow or block specific traffic based on a defined set of security rules.
Firewall techniques
Techniques used:
1. Packet filtering: Looks at IP address and Port # and drops packets coming from or destined to certain IP
addresses
2. Circuit level gateways: Detect conversations by looking at end-point pairs
3. Application layer filtering: Detects applications trying to use disallowed protocols or ports
4. Hide addresses and perform network address translation.
– Hacker can not know the IP address of the server that receives the message. Even if it knows, the
firewall will block it.
Business Process Management Tools: Business Process Management (BPM) tools are used for automating,
measuring and optimizing business processes.
216 | P a g e Software Architecture
BPM tools use workflow and collaboration to provide meaningful metrics to business leaders
Example: Appian, Zoho
SSL
1. Browser connects to a web server (website)
secured with SSL (https). Browser requests that the
server identify itself.
2. Server sends a copy of its SSL Certificate, including
the server’s public key.
3. Browser checks the certificate root against a list of
trusted CAs and that the certificate is unexpired,
unrevoked, and that its common name is valid for
the website that it is connecting to. If the browser
trusts the certificate, it creates, encrypts, and sends
back a symmetric session key using the server’s
public key.
4. Server decrypts the symmetric session key using its
private key and sends back an acknowledgement
encrypted with the session key to start the
encrypted session.
5. Server and Browser now encrypt all transmitted
data with the session key.
Asynchronous operation
217 | P a g e Software Architecture
Supervised learning
• Supervised: In this approach, we provide a labelled dataset to the machine.
• Labelled dataset consists of features and result or class.
• Using the dataset, the machine builds a model (an equation or structure) to predict.
Unsupervised Learning
• Unsupervised: Here we have an unlabelled dataset. We do not know what all features will constitute a class.
The machine learns by itself and builds a model.
Circles indicates clusters of crime areas in Delhi
Clustering
• Customers can be segmented (clustered) based on Gender, age, annual income, products purchased, etc.
(Luxury car buyers)
• We can source potential customer data and determine to which segment they belong to.
• Based on the segment, we can target them and send promotion details for the right product
Reinforcement Learning
• Reinforcement Learning: In this, the machine learns from the environment by interacting with it.
• The machine is provided a set of allowed actions, rules and potential end states.
• By exploring different actions and observing resulting reactions the machine learns to exploit the rules to
create a desired outcome.
222 | P a g e Software Architecture
Deep Learning
• Deep learning: Used to understand and analyse image, sound and video. Uses Neural networks
• Used to understand human language (Natural Language Processing - NLP). Eg. Chatbots
Neural networks
• These networks can learn and model the relationships between inputs and outputs that are complex.
• Examples: Detecting rare events such as frauds, help doctors with an opinion
Popular tools
• Scikit Learn - It provides models and algorithms for Classification, Regression, Clustering, Dimensional
reduction, Model selection
• PyTorch – Neural Networks
• Tensor Flow – Neural networks
• Apache Mahout - Regression, Clustering, Recommenders, and Distributed Linear Algebra.
• Spark MLib –
Experience sharing
What problem did you solve using ML?
What steps did you follow to develop the system?
What were the key challenges you faced?
• Those processes performed to finalize all activities across all Process Groups to formally close the project
or phase.
– SA: Designs for quality and tracks system against design. Defines code-level quality metrics.
Resource Management
• Organise, manage and lead ensuring that the project makes the most effective use of the people involved
with the project.(Human Resource Management in PMBOK6)
• Managing people and their careers
– PM: Maps skill sets of people against required skill sets. Ensures that appropriate training is
provided. Monitors and mentors career paths of individuals. Authorizes recruitment.
– SA: Defines required technical skill sets. Mentors developers about career paths. Recommends
training. Interviews candidates.
Communications Management
• Ensuring timely and appropriate planning, collection, creation, distribution, storage, retrieval, management,
control, monitoring, and the ultimate disposition of project information.
• Communicating
– PM: Manages communication between team and external entities. Reports to upper management.
– SA: Ensures communication and coordination among developers. Solicits feedback as to progress,
problems, and risks.
Risk Management
• conducting risk management planning, identification, analysis, response planning, and controlling risk on a
project.
• Risk Management
– PM: Prioritizes risks, reports risks to management, takes steps to mitigate risks.
– SA: Identifies and quantifies risks, adjusts architecture and processes to mitigate risk.
Procurement Management
• Purchase or acquire products, services, or results needed from outside the project team. Processes in this
area include Procurement Planning, Solicitation Planning, Solicitation, Source Selection, Contract
Administration, and Contract Closeout.
• Technology
– PM: Procures necessary resources. Introduces new technology.
– SA: Determines technology requirements. Recommends technology, training, and tools.
Project Stakeholder Engagement
• The processes required to identify all people or organizations impacted by the project, analyzing stakeholder
expectations and impact on the project, and developing appropriate management strategies for effectively
engaging stakeholders in project decisions and execution.
• PM- Assess key participants and how the project affects their problems and needs.
• SA- Ensure the stakeholders’ needs and concerns are dealt with appropriately.
Processes/Activities – Knowledge Areas
• Each of the ten knowledge areas contains the processes that need to be accomplished within its discipline
in order to achieve effective project management.
• Each of these processes also falls into one of the five process groups, creating a matrix structure such that
every process can be related to one knowledge area and one process group.
Global Software Development
• A very common development context.
• Driven by
– (Labor) costs
– Skill sets and labor availability.
– Local knowledge of markets.
• Global development means that coordination among teams is critical.
Team Coordination Induced by Module Interaction
If there is a dependency between two modules, the teams assigned to those modules must coordinate over the
shared interfaces.
228 | P a g e Software Architecture
Coordination
• Local coordination can be informal and spontaneous.
• Remote coordination must be more structured.
• Coordination mechanisms:
– Documentation
– Meetings
– Electronic media
Implementation Issues
• Trade-offs
• Incremental development
• Tracking progress
Trade-offs
• Software architect makes trade-offs among various quality attributes.
• Project manager makes trade-offs among
– Features
– Schedule
– Quality
• Project manager should resist creeping functionality (scope creep)
– Affects schedule
– Can use a Change Control Board to manage (typically slow down) the pace of changes
Incremental Development
• A release may be in one of three states
– Planning
– Development
– Test and repair
• All three states can be simultaneously active for different releases.
Tracking Progress
Progress can be tracked through
– Personal contact (doesn’t scale)
– Meetings
– Metrics
– Risk management
Meetings
– Expensive use of time
– Either status or working – do not intermix
– One output of status meetings should be risks
Risks have
– Cost if they occur
– Likelihood of their occurrence
Project manager prioritizes risks
Measuring
• Metrics are an important tool for project managers. They enable the manager to have an objective basis
both for their own decision making and for reporting to upper management on the progress of the project.
229 | P a g e Software Architecture
• Metrics can be global—pertaining to the whole project—or they may depend on a particular phase of the
project.
Global Metrics
• Global metrics aid the project manager in obtaining an overall sense of the project and tracking its progress
over time.
• Some example metrics, that any project should capture:
– Size
– Schedule deviation
– Developer productivity
– Defects
• Metrics should be tracked both historically for the organization and for the specific project.
Phase Metrics and Cost to Complete
Phase metrics
– Open issues
– Unmitigated risks
Cost to complete
– Bottom-up metric
• Responsibility of lead architect for each subsystem team
Governance
Four responsibilities of a governing board
1. Implementing a system of controls over the creation and monitoring of all architectural components
and activities, to ensure the effective introduction, implementation, and evolution of architectures
within the organization.
2. Implementing a system to ensure compliance with internal and external standards and regulatory
obligations.
3. Establishing processes that support effective management of the above processes within agreed
parameters.
4. Developing practices that ensure accountability to a clearly identified stakeholder community, both
inside and outside the organization.
Summary
• A project must be planned, organized, implemented, tracked, and governed.
– Top-down schedule based on size
– Bottom-up schedule based on top level decomposition.
– Reconciliation of two schedules is the basis for the software development plan.
• Teams are created based on the software development plan.
• The software architect and the project manage must coordinate to oversee the implementation.
• Global development creates a need for an explicit coordination strategy.
• Management trade offs are between schedule, function, and cost.
• Progress must be tracked.
• Larger systems require formal governance mechanisms.
• Example:
• Using redundant hardware to achieve a desired level of availability has a cost
• Checkpointing to a disk file has a different cost.
• Both of these architectural decisions will result in measurable levels of availability that will have
some value to the organization developing the system.
• Knowing the costs and benefits associated with particular decisions enables reasoned selection from among
competing alternatives.
• Economic analysis does not make decisions for the stakeholders. It simply aids in the elicitation and
documentation of value for cost (VFC).
• VFC: a function of the costs, benefits, and uncertainty of a “portfolio” of architectural investments.
• It gives the stakeholders a framework within which they can apply a rational decision-making
process that suits their needs and their risk aversion.
• Economic analysis isn’t something to apply to every architectural decision, but rather to the most basic ones
that put an overarching architectural strategy in place.
Basis for Economic Analyses
• Begin with a collection of scenarios generated from requirements elicitation, architectural evaluation, or
specifically for economic analysis.
• Examine how these scenarios differ in the values of their projected responses.
• Assign utility to those values.
• The utility is based on the importance of each scenario with respect to its anticipated response
value.
• Consider the architectural strategies that lead to the various projected responses.
• Each strategy has a cost, and each impacts multiple quality attributes.
• That is, an architectural strategy could be implemented to achieve some projected response, but
while achieving that response, it also affects some other quality attributes.
• The utility of these “side effects” must be taken into account when considering a strategy’s overall
utility.
• Combine this overall utility with the project cost of an architectural strategy to calculate a final VFC measure.
Utility-Response Curves
• Our economic analysis uses quality attribute scenarios (from Chapter 4) as the way to concretely express
and represent specific quality attributes.
• When we vary the values of the responses, and ask what the utility is of each response we get a set of
points that we can plot: a utility-response curve.
• Each scenario’s stimulus-response pair provides some utility (value) to the stakeholders, and the utility of
different possible values for the response can be compared.
• To help us make major architectural decisions, we might wish to compare the value of high
performance against the value of high modifiability against the value of high usability, and so forth.
The concept of utility lets us do that.
• With prodding, stakeholders can express their needs using concrete response measures, such as “99.999
percent available.” But how much would they value slightly less demanding quality attributes, such as “99.99
percent available”? Would that be almost as good?
• If so, then the lower cost of achieving that lower value might make that the preferred option,
231 | P a g e Software Architecture
• Capturing the utility of alternative responses of a scenario better enables the architect to make tradeoffs
involving that quality attribute.
• We can portray each relationship between a set of utility measures and a corresponding set of response
measures as a graph—a utility-response curve.
Example Utility-Response Curves
• These levels—best-case and worst-case—are assigned utility values of 100 and 0, respectively.
Practicalities of Weighting Determination
• One method of weighting the scenarios is to prioritize them and use their priority ranking as the weight.
• For N scenarios, the highest priority one is given a weight of 1, the next highest is given a weight of
(N–1)/N, and so on.
• This turns the problem of weighting the scenarios into one of assigning priorities.
• The stakeholders can determine the priorities through a variety of voting schemes.
• One simple method is to have each stakeholder prioritize the scenarios (from 1 to N) and the total
priority of the scenario is the sum of the priorities it receives from all of the stakeholders.
• Voting can be public or secret.
• Other schemes are possible. Regardless of the scheme used, it must make sense to the stakeholders and it
must suit their culture.
Practicalities of Cost Determination
• There are very few cost models for various architectural strategies.
• There are many software cost models, but they are based on overall system characteristics such
as size or function points.
• These are inadequate to answer the question of how much does it cost to, for example, use a
publish-subscribe pattern in a particular portion of the architecture.
• There are cost models that are based on complexity of modules (by function point analysis
according to the requirements assigned to each module) and the complexity of module interaction,
but these are not widely used in practice.
• More widely used in practice are corporate cost models based on previous experience with the
same or similar architectures, or the experience and intuition of senior architects.
Practicalities of Cost Determination
• Architects often turn to cost estimation techniques.
• An absolute number for cost isn’t necessary to rank candidate architecture strategies.
• You can often say something like “Suppose strategy A costs $x. It looks like strategy B will cost
$2x, and strategy C will cost $0.5x.” That’s enormously helpful.
• A second approach is to use very coarse estimates. Or if you lack confidence for that degree of
certainty, you can say something like “Strategy A will cost a lot, strategy B shouldn’t cost very
much, and strategy C is probably somewhere in the middle.”
Cost Benefit Analysis Method (CBAM)
The CBAM places the principles just discussed into a set of steps: a method.
CBAM Stakeholders
233 | P a g e Software Architecture
• The stakeholders in a CBAM exercise include people who can authoritatively speak to the utility of various
quality attribute responses.
• They probably include the same people who were the source of the quality attribute scenarios being used as
input.
Step 1
• Collate scenarios.
• Give the stakeholders the chance to contribute new scenarios.
• Ask the stakeholders to prioritize the scenarios based on satisfying the business goals of the
system.
• This can be an informal prioritization using a simple scheme such as “high, medium, low” to rank
the scenarios.
• Choose the top one-third for further study.
Step 2
• Refine scenarios.
• Refine the scenarios chosen in step 1, focusing on their stimulus-response measures.
• Elicit the worst-case, current, desired, and best-case quality attribute response level for each
scenario.
• For example, a refined performance scenario might tell us that worst-case performance for our
system’s response to user input is 12 seconds, the best case is 0.1 seconds, and our desired
response is 0.5 seconds. Our current architecture provides a response of 1.5 seconds.
Step 3
• Prioritize scenarios.
• Prioritize the refined scenarios, based on stakeholder votes.
• Give 100 votes to each stakeholder and have them distribute the votes among the scenarios,
where their voting is based on the desired response value for each scenario.
• Total the votes and choose the top 50 percent of the scenarios for further analysis.
• Assign a weight of 1.0 to the highest-rated scenario; assign the other scenarios a weight relative to
the highest rated.
• This becomes the weighting used in the calculation of a strategy’s overall benefit.
• Make a list of the quality attributes that concern the stakeholders.
Step 4
• Assign utility.
• Determine the utility for each quality attribute response level (worst-case, current, desired, best-
case) for the scenarios from step 3.
• You can conveniently capture these utility curves in a table (one row for each scenario, one column
for each of the four quality attribute response levels).
Step 5
• Map architectural strategies to scenarios and determine their expected quality attribute response levels.
• For each architectural strategy under consideration, determine the expected quality attribute
response levels that will result for each scenario.
Step 6
• Determine the utility of the expected quality attribute response levels by interpolation.
• Using the elicited utility values (that form a utility curve), determine the utility of the expected quality
attribute response level for the architectural strategy.
• Do this for each relevant quality attribute enumerated in step 3.
234 | P a g e Software Architecture
• For example, if we are considering a new architectural strategy that would result in a response time
of 0.7 seconds, we would assign a utility proportionately between 50 (which it exceeds) and 80
(which it doesn’t exceed).
• The formula for interpolation between two data points (xa, ya) and (xb, yb) is:
• For us, the x values are the quality attribute response levels and the y values are the utility values.
So, employing this formula, the utility value of a 0.7-second response time is 74 .
Step 7
• Calculate the total benefit obtained from an architectural strategy.
• Subtract the utility value of the “current” level from the expected level and normalize it using the
votes elicited in step 3.
• Sum the benefit due to a particular architectural strategy across all scenarios and across all
relevant quality attributes.
Step 8
• Choose architectural strategies based on VFC subject to cost and schedule constraints.
• Determine the cost and schedule implications of each architectural strategy.
• Calculate the VFC value for each as a ratio of benefit to cost. Rank-order the architectural
strategies according to the VFC value and choose the top ones until the budget or schedule is
exhausted.
Step 9
• Confirm results with intuition.
• For the chosen architectural strategies, consider whether these seem to align with the
organization’s business goals.
• If not, consider issues that may have been overlooked while doing this analysis.
• If there are significant issues, perform another iteration of these steps.
CASE STUDY : The NASA ECS Project
• The Earth Observing System is a constellation of NASA satellites that gathers data for the U.S. Global
Change Research Program and other scientific communities worldwide.
• The Earth Observing System Data Information System (EOSDIS) Core System (ECS) collects data from
various satellite downlink stations for further processing.
• ECS’s mission is to process the data into higher-form information and make it available to scientists in
searchable form. The goal is to provide both a common way to store (and hence process) data and a public
mechanism to introduce new data formats and processing algorithms, thus making the information widely
available.
• The ECS processes an input stream of hundreds of gigabytes of raw environment-related data per day. The
computation of 250 standard “products” results in thousands of gigabytes of information that is archived at
eight data centers in the United States. The system has important performance and availability and
modifiability requirements.
• The ECS project manager had a limited annual budget to maintain and enhance his current system. The
manager used the CBAM to make a rational decision based on the economic criterion of return on
investment.
Step 1: Collate Scenarios
IN PRIORITY ORDER – Note that they are not yet well formed and that some of them do not have defined
responses. These issues are resolved in step 2, when the number of scenarios is reduced.
1. Reduce data distribution failures that result in hung distribution requests requiring manual intervention.
2. Reduce data distribution failures that result in lost distribution requests.
3. Reduce the number of orders that fail on the order submission process.
4. Reduce order failures that result in hung orders that require manual intervention.
5. Reduce order failures that result in lost orders.
6. There is no good method of tracking ECSGuest failed/canceled orders without much manual intervention
(e.g., spreadsheets).
7. Users need more information on why their orders for data failed.
8. Because of limitations, there is a need to artificially limit the size and number of orders.
9. Small orders result in too many notifications to users.
235 | P a g e Software Architecture
10. The system should process a 50-GB user request in one day, and a 1-TB user request in one week.
Step 2: Refine Scenarios
• The scenarios were refined, paying particular attention to precisely specifying their stimulus-response
measures.
• The worst-case, current-case, desired-case, and best-case response goals for each scenario were elicited
and recorded in a table.
Step 5: Develop Architectural Strategies and Determine Their Expected Quality Attribute Response Levels
• Based on the requirements implied by the preceding scenarios, a set of 10 architectural strategies was
developed by the ECS architects.
• For each architectural strategy/scenario pair, the response levels expected to be achieved with respect to
that scenario are shown (along with the current response, for comparison purposes).
Step 6: Determine the Utility of the “Expected” Quality Attribute Response Levels by Interpolation
• Once the expected response level of every architectural strategy has been characterized with respect to a
set of scenarios, their utility can be calculated by consulting the utility scores for each scenario’s current and
desired responses for all of the affected attributes.
• Using these scores, we may calculate, via interpolation, the utility of the expected quality attribute response
levels for the architectural strategy/scenario pair.
Step 6 Results
• Bi = ∑j (bi,j × Wj)
• This equation calculates total benefit as the sum of the benefit that accrues to each scenario, normalized by
the scenario’s relative weight.
• Using this formula, the total benefit scores for each architectural strategy are now calculated.
Step 7