56
Software Architecture CS 4311

Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Embed Size (px)

Citation preview

Page 1: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Software Architecture

CS 4311

Page 2: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architecture

Arch Beam Suspension Cable-stayed

• Design at the highest level• Example: bridge architectures

Page 3: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architecture

Arch Beam Suspension Cable-stayed

• Design at the highest level• Example: bridge architectures

Why do civil engineers talk about bridge architectures?

Page 4: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

What is architecture?

• Dictionary definitions:– archangel, archenemy, archduke,

archbishop– matriarch, patriarch, monarch

• Arch as prefix or suffix: – main, chief, principal, most important,

highest, fundamental, basic, extreme or most characteristic, ruler, leader

Page 5: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architecture

• The art and science of designing and erecting buildings

• Fundamental underlying design of buildings

• Style and method of design and construction of buildings

• Buildings and other structures

Page 6: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

What is software architecture?

• Framework

• Mechanism

• Way

• Shape

• Form

• Means

• Organization

• Arrangement

• The Big Picture !

Page 7: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Software Architecture

the structure or structures of the system– software components– externally visible properties of those

components– the relationships between them

• the set of principle design decisions made about a software system.

Page 8: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

What design decision?

• System structure

• Functional behavior

• Interaction

• Nonfunctional properties

• Implementation

• System goals, Stakeholders, Nontechnical considerations

Page 9: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Independent Components

• Broadcasts• Client-server• Event driven

– Components register for an event. System invokes all registered components when event happens.

– Example: Java AWT

– Dynamic, responsibility with event handler, not event generator.

– Can be hard to test/debug.

Page 10: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Virtual Machines

• Interpreters:– Program to be executed– Interpreter: simulate instructions in program– State: State of program, state of interpreter

• Examples: – JVM– Command language processors

Page 11: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Repositories

• Central Data store + operations {store, retrieve, update}

• Traditional: transactions trigger processing• Blackboard: Central store controls

processing– Processes write to central store (knowledge

sources)– Processes respond to changes in the store

Page 12: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Layered Architecture

• Layers are hierarchical• Each layer provides services to the outer layer

which is a client to the inner layer• Layers can have access to adjacent layers (direct

access only)• The design includes how each pair of layers

interact (protocols)• Layered architectures are often used for interactive

information services

Page 13: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Example

Layered security architecture

Cryptography

File interface

Key management

User

Page 14: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Advantages and Drawbacks

+ Each layer can be seen as a higher level of abstraction

+ A change on one layer affects only layers interacting with the changed layer

+ Clearly favors reuse- Layers are not always obvious when looking at the

requirements- Performance may suffer from the extra

coordination among the layers

Page 15: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Presentation

ApplicationControl andCoordination

DomainServices andInformation

LegacyDatabaseServices

Browsers

Web Server

App Server

Db Server

Layered Architectures in Interactive Information Systems

Page 16: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Presentation

ApplicationServices

DomainServices

TechnicalServices

Events Results

Results

ResultsMessages

Messages

Characteristic Object Roles

Interfacers

Information holders, service

providers,Structures,

coordinators, and domain controllers

Coordinators, and

(application) controllers

Interfacers

Windows and Widgets

Page 17: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Locating Objects in Layers

• Once we have agreed on a layered architecture, we need to identify objects (classes) in layers

• One approach is to use Class-Responsibility-Collaboration

-objects collaborates mostly within their layers

-client objects will tend to be in an outer layer (requests go inside)

-information goes outside

Page 18: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Process Control

• Process maintains setpoint

• Control based on – input variables (feedforward) – Output variables (feedback)

• Examples: – Thermostat controlled heater

– “smart” stock trader

Page 19: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architecture Elements

• Components

• Connectors

• Configuration Topologies

• Models

Page 20: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Components

• Elements that encapsulate processing and data in a system’s architecture are referred to as software components.

• An architectural entity that – encapsulates a subset of the system’s functionality

and/or data, – restricts access to that subset via an explicitly

defined interface, and – had explicitly defined dependencies on its required

execution context.

Page 21: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Connector

• Elements that are tasked with effecting and regulating interactions among components.

• Application independent.

Page 22: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Configuration Topology

• A set of specific associations between the components and connectors of a software system’s architecture.

Page 23: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Models

• An artifact that captures some or all of the design decisions that comprise a system’s architecture.

• Architectural modeling is the reification and documentation of those design decisions.

• Different models: – structural vs. behavioral

– static vs. dynamic

– scope

Page 24: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architectural Styles

• A named collection of architectural design decisions that: – are applicable in a given development context,

– constrain architectural design decisions that are specific to a particular system with that context, and

– elicit beneficial qualities in each resulting system.

• Not about: specific systems, components, interaction mechanisms, or configurations.

Page 25: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

An Architectural Style Example

• Physically separate the software components used to request services from the components that provide the services, to allow for proper distribution and scaling up, both in the number of service providers and service requesters.

• Make the service providers unaware of the requesters’ identity to allow the providers to service transparently many, possibly changing requestors.

• Insulate the requesters from one another to allow for their independent addition, removal, and modification. Make the requesters dependent only on the service providers.

• Allow for multiple service providers to emerge dynamically to off-load the existing providers should the demand for services increase above a given threshold.

Page 26: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures
Page 27: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Architectural Styles

Remarks:• Each style has its own advantages and drawbacks• An application may require several architectural

views• Choosing the right views is a key factor in having a good design

Page 28: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Advantages of Architectural Styles

Each combination of styles emphasizes one or more of the quality attributes below:

• Usability

• Availability

• Security

• Performance

• Maintainability

• Flexibility

• Portability

Page 29: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Example Software Architectures

• Batch Sequential• Blackboard• Client Server• Database-centric • Distributed

Computing• Event driven• Interpreter• Monolithic

application

• Peer-to-peer• Pipe and Filter• Plug-in• Service-oriented• Search-oriented• Space-based• Shared nothing• Three-tier model• Rule evaluation

Page 30: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Assignment:• Base Groups• Each teams has until next class to prepare a 3

minute description of the provided architecture• You will present next class

– What is it– What problem does it solve– How does it solve the problem– Who are the actors– How do they relate to each other

• You will need to be efficient to cover the architecture in 3 minutes

• Send me 2 or 3 powerpoint slides by 5pm Wednesday– INCLUDE YOUR SOURCES

Page 31: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Example Software Architectures

• Team 1 Blackboard• Team 2 Interpreter• Team 3 Plug-in• Team 4 Search-oriented• Team 5 Space-based• Team 6 Shared nothing• Team 7 Publisher-subscriber• Team 8 Rule evaluation

Page 32: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Batch Sequential Architecture

• A series of dedicated and independent components that transforms data in a sequential manner (Each component needs to finish its task before the next one can start).

Page 33: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Batch Sequential Architecture

• Solve complex task– Divide complex tasks into several easier tasks.

• Modifiability/Maintainability– Easy to change/fix the behavior of a component.

• Reusability– By only changing the components that interact with

the environment the system can work on different structures.

• Flexibility– Additional components are easy to integrate.

Page 34: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Batch Sequential Architecture

• Actors– The actors consist of the independent components

(programs) that run in sequence to achieve the ultimate desired output of the system.

– Each components is responsible for a particular task and supplies the next component with the intermediate data once it has completed its task.

• How do they relate to each other?– They are related to each other by the data that they

each transform.

Page 35: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Batch Sequential Architecture*Example: Compiler

*Software Design Methodology, By Hong Zhu © 2005

Page 36: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Client-Server Architecture• Application context:

– Clients request services from a server– Centralization of computation and data at the

server– Separation of user interface tasks from

computation and data management and storage

• For examples: – Websites, etc.

Page 37: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Client Server Architecture

Example:

Page 38: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Database-Centric Architecture

• Critical databases applications always need a global transaction monitor.– can significantly reduce performance and

scalability.• Architecture solves data management and

processing of it. • Computes all the data to a single place, in

this case the database.

Page 39: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

DBMS

SERVER 1 SERVER 2

Client 1

Client 2

Client 3

Client 4 Client

5

Client 6

Benefits:Reduces amount of code, development time, network traffic, complexity of applications.

Actors and their roles

Page 40: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Distributed Computing Architecture

• Also known as grid computing.• Makes use of the hardware on several computers.• Primarily used to solve those problems that require

exceptionally heavy computation. • SETI@Home was the first project that demonstrated

the feasibility of distributed computing to solve these problems.– Indeed, this was one of the primary goals of

SETI@Home.– The specific problem SETI@Home is used for is to

detect intelligent life outside of Earth.

Page 41: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Distributed Computing Architecture• The software written for SETI@Home requires 2

components:– Central server software manages the

distribution of data across personal computers and the collection of analyzed data.

– Personal computer software performs analysis and monitors processor usage, ensuring that analysis is done only when the processor is not otherwise needed.

Page 42: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Event Driven Architecture

• Components in the system react to certain events.– For example

• State changes• I/O events

• Creates responsiveness in a changing environment• Actors

– Agents: components in a system that generate events– Sinks: event consumers

• Responsibility of applying action as soon as event is present• May act as a filter to another component• May provide an action based the given event

Page 43: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Event Driven Architecture

• Characteristics– Facilitates responsiveness – Works great in un-normalized unpredictable

environments • Event flow

– Sensing of fact– Technical representation in the form of an event– Reaction(s) to set event

• Example– Email application displays a message stating that a

new e-mail has been received

Page 44: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Event Driven Architecture

Agent

Sink 1 Sink 2 Sink 3Sink n-1

Sink n

event

action action action action

event transformation

Page 45: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Monolithic Architecture

• Single-Tier Architecture• Concept of having user interface and application

of data access in one single program. • Only application is accountable for computations• Simplest software configuration

– No modularity

– Not a typical Software Engineering Concept

Page 46: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Why Monolithic Architecture?

• Low Cost– Less Complex – No need to develop external computational or

processing modules

• Simple and Quick design– Single independent application

• No need for future expansion of software– Not easily maintained

Page 47: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Peer-to-Peer Architecture

• A type of architecture in which each class has equivalent capabilities and responsibilities

• A class can collaborate with any other class and vice versa

• Every class has access to the resources needed

• Every class gives access to all its resources

• No Super-classes

Page 48: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Peer-to-Peer Architecture

• Advantages:• Decentralized computing with flow of control and

resources distributed among peers • Highly robust in the face of failure • Scalable in terms of access to resources and

computing power

• Cautions: • When information retrieval is time critical• Security

Page 49: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Pipe and Filter

• This is an architecture composed of filters and pipes:– A filter is a program that reads a stream and writes a

stream

– A pipe is middle where that directs the output stream of one program to the input stream of another

Filter FilterFilterInput Data

TransformedData

TransformedData

Page 50: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Pipe and Filter

• This is an architecture composed of filters and pipes:– A filter is a program that reads a stream and writes a

stream

– A pipe is middle where that directs the output stream of one program to the input stream of another

• Useful when you have common stream processing programs that can be reused

• The cost is that a lot of I/O processing is duplicated (e.g., parsing the data)

Page 51: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Example Pipe and Filter

• Example: Unix shell scripts

ccl1 fred.txt | ccp0 | ccp1 | ccp2 > fred.o

• | is the pipe operator– Read from the standard output of program to

left– Write to standard input of program to right

Page 52: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Pipe and Filter

• Components are isolated– Easy to understand and reuse filters– Evolution is easy: replace filter– Allows concurrent execution– May be easy to analyze (analyze each filter for

throughput, accuracy)– Batch or stream, not interactive– Replication of effort (reading, writing, parsing)

Page 53: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Service-Oriented Architecture (SOA)

• Problem– Client needs access to multiple features however

the client shouldn’t know how those features are implemented

• SOA:– Provides access to multiple components or

functions – Client doesn‘t know what components or how

functionality is implemented

Page 54: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

SOA

• Solve the Problem– Provides an interface that hides the components and

gives the client a single access point.

• Actors– Client– Components

Page 55: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Three-Tier Architecture• client-server architecture

• Three different tier– Presentation

• Input/ output

– Business• Data processing

– Data Access• Read/Write

Page 56: Software Architecture CS 4311. Architecture Arch Beam Suspension Cable-stayed Design at the highest level Example: bridge architectures

Three-Tier Advantages

• Highly cohesive and lowly coupled

• Allows change in modules with out effect on the other tiers

• Encapsulates tasks