architecture architecture is a high level description of a solution to a problem recall architecture...

28
Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design ) includes: 1. Main Components functionalities (responsibilities) and properties of components 2. Major Relations components collaborating among the components sometimes include the interface

Upload: percival-mccormick

Post on 29-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Architecture

• Architecture is a high level description of a solution to a problem

• Recall architecture (high level design) includes:

1. Main Components– functionalities (responsibilities) and properties of

components

2. Major Relations– components collaborating among the components– sometimes include the interface

Page 2: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Architectural Style

• An Architectural Style defines a set of rules that describe:

1. the properties of and constraints on its components and

2. The way in which the components interact

“Architectural Style” is a High Level Design Pattern

Page 3: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Architectural Styles (Patterns)

• Architectural Styles may be viewed as a set of Architectural Design “solutions” that have been used successfully before.

• These styles (or patterns) offer multiple benefits: 1. Promotes communications among the designers because

the pattern names are used as a shorthand for a lengthy description

2. Streamlines documentation for the same reason above3. Supports high level of reuse if the pattern is applicable4. Improves development efficiency and productivity for

above reasons and not having to profile or prototype all the existing patterns

5. Provide a starting point for additional and new design ideas.

A software design pattern is a model for a class of solutions to a software design problem. At high level we call these patterns architectural styles.

Page 4: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Software Design Patterns• Software Design Patterns is a recent event, although

programming level “patterns” have been studied in our industry such as Sorts, Search, Access Methods, etc.

• A building architect named Christopher Alexander introduced building designs based on “patterns” in the 1970’s and catalogued these designs in a book.– Has not been widely accepted by building architects– But has influenced the software design community in the last 15

years in terms of cataloguing and using design patterns.

My personal thoughts:

Design Patterns come in different levels: 1. - the high level architecture is not detailed enough and should only serve as a guideline pattern for further refinement 2. - the middle level ones is where the current work is focused on and may be domain dependent 3. - low level ones (e.g. data structures and algorithms) have been employed relatively successful via provided code libraries

Page 5: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Major Architectural Styles (Patterns)

1. Layered Architecture2. Pipe and Filter3. Shared (Central) Data Store4. Event Driven5. Model-View-Controller (MVC)

6. “Distributed & Emerging” Service Oriented Architecture (SOA)

Page 6: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Layered architecture• The high level design solution is decomposed into

Layers:– Structurally, each layer provides a related set of services– Dynamically, each layer may only use (evoke) the layers

below it• Using and evoking is not necessarily the same (subtle difference))

– Layer A may use layer B because it depends on something B does (e.g. data written to a db by B to be used by A), but never call upon it.

– Layer A evokes layer B says Layer A passes control or data or both directly to B.

ScreenPresentation layer

Logic layer

File layer

1. If any layer only uses the layer directly below it, then it is a Strict Layered Style.

2. If a layer may use any of the layers below it, then it is a Relaxed Layer Style

Problems that seem to fit this architecture include tele-comm and op-sys

Page 7: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Simple Example with “Mailing Address” Processing

Recipient Name

Street

City

State

Country

Mail processing to establish which delivery plane/truck to distribute the US Postal mailThe sequence is from top layer to the lower layer.

This same scheme is often used in communications protocol architecture

Page 8: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

“Sample” Layered Communications Architecture

Application layer

Presentation layer

Session layer

Transport layer

Network layer

Data Link layer

Physical layer

Page 9: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

A Simplified “Experiential” Discussion

customerinfo valid.

update

orderinfo valid.

productinfo valid.

add

updateupdate

delete

addadd

deletedelete

Information I/o Layercust info I/O ord. info I/O prod info I/O

Viewing and designing directly from functional requirements

Viewing from internal structure and form; then designing with “commonality” in mind

Ending up with layered architecture

Discuss - - Pros and Cons in class: modularity; coupling; cohesion

Cust. Infovalidation

product Infovalidation

. . .

Information validation Layer

Info Processing Layer

Add, Delete, and Update

Page 10: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Sample Layered Architecture for OS

Resource (I/O, page,network, file, etc.) management

Utilities (editors, sys commands, compilers, internet access, libraries, etc.)

kernel (Device & memoryProcessing) drivers Process (classification &

management)

How many of the layers would we need to worry about ---- for the currently popular “security” issue ?

Page 11: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Advantages and Disadvantages ofLayered Architecture

• Advantages:– Each layer is selected to be a set of related services; thus the

architecture provides high degree of cohesion within the layer.– Each layer may hide private information from other layers– Layers may use only lower layers, constraining the amount of

coupling. – Each layer, being cohesive and is coupled only to lower layers,

makes it easier for reuse by others and easier to be replaced or interchanged (change of DB touches only the data store/access layer, change of browser only changes the presentation layer of the previous slide) ---- good for component design

• Disadvantages:– Strict Layered Style may cause performance problem depending on

the number of layers– Debugging in Strict Layered Style may be complex (questionable?)– May be difficult to decide on the number of layers

I beg to differ

Page 12: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Pipe and Filter Architecture

• Main components:

– Filter: process the a stream of input data and turn into some output data

– Pipe: a conduit that allows the flow of data

read input file process file

filter

pipe

This architecture style also focuses on the “flow” (dynamics)rather than just the structural

Page 13: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Pipe and Filter : UNIX Influence• UNIX command line processing of the pipe symbol, l

- the output from the command to the left of the symbol, l, is to be sent as input to the command to the right of the pipe;

- this mechanism got rid of specifying a file as std output of a command and then specifying that same file as the std input to another command, including possibly removing this intermediate file afterwards

Example : Assume that in the file called my.txt is the following:

I live inthe cityof Atlanta

Example ( UNIX commands) : $ cat my.txtI live inthe cityof Atlanta$ cat my.txt I sed “s/i/o/g”I love onthe cotyof Atlanta $

First cat command outputs my.txt to screen. The second cat command reads my.txt and

sends it to sed command which “search” for “i’ and “globally” replace it with “o.”

Note the pipesymbol, l

Page 14: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

More Modern Version of Pipe-filter

• Consider the MS Office Product

• Specifically --- think about how the component called “copy” works in conjunction with the component called “paste” across office product (e.g. spread sheet to word document )

How may this be extended to the way e-mail with file attachment work?

Page 15: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Pipe-Filter architecture & Batch Processing

• The high level design solution is decomposed into 2 parts (filters and pipes):– Filter is a service that transforms a stream of input data into

a stream of output data

– Pipe is a mechanism or conduit through which the data flows from one filter to another

Input time cards

Prepare for Check processing

Process Checks

Problems that require batch file processing seem to fit this architecture: e. g. payroll and compilers

Page 16: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Pipe – Filter with error-processing

• Even though interactive error processing is difficult, but batch error processing can be done with pipe and filter architecture

Input time cards

AutomaticallyProcess Checks

Manually ReprocessCard and Cut Check

Payroll report

Do the data streams need to be synchronizedhere for report?

Splitting the good timecards from the bad ones

[valid][invalid]

Input Validation

Page 17: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Advantages and Disadvantages ofPipe-Filter

• Advantages:– Filters are self containing processing service that performs

a specific function thus it is fairly cohesive– Filters communicate (pass data most of the time) through

pipes only, thus it is “somewhat” constrained in coupling

• Disadvantages:– Filters processes and sends streams of data over pipes is a

solution that fits well with heavy batch processing, but may not do well with any kind of user-interaction.

– Anything that requires quick and short error processing is still restricted to sending data through the pipes, possibly making it difficult to interactively react to error- events.

Page 18: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Shared Data

• The high level design solution is based on a shared data-store which acts as the “central command” with 2 variations:– Blackboard style: the data-store alerts the participating

parties whenever there is a data-store change (trigger)– Repository style: the participating parties check the data-

store for changes

Patientdatabase

physiciandiagnosis

pharmacy &drug processing

Lab testing

accounting& administration

Problems that fit this style such as patient processing, tax processing system, inventory control system; etc. have the following properties:

1. All the functionalities work off a single data-store. 2, Any change to the data-store may affect all or some of the functions 3. All the functionalities need the information from the data-store

** Very Common In Business whereData isCentral **

Page 19: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Blackboard Style & DB triggers

• In database management system we can set up a trigger which has 3 parts:

– 1) Event : change to the database that alerts or activates the trigger

– 2) Condition: a test that is true when the trigger is activated

– 3) Action: a procedure which is executed when the trigger is activated and the condition is true.

1) A trigger may be thought as a monitor of the database for changes to the database that matches the event specification (e.g. debit of bank cust. accnt) 2) Then the “condition” is checked to see if it is true (e.g. debited cust account results in negative bank accnt amount). 3) If the debited account has a negative accnt amount, then kick off a procedure to send error message out and delay the execution of cust account debiting.

Page 20: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Advantages and Disadvantages ofShared Data

• Advantages:– The independent functions are cohesive within itself and the

coupling is restricted to the shared data– Single data-store makes the maintenance of data in terms of

back-up recovery and security easier to manage

• Disadvantages:– (common and control coupling through data) Any data format

change in the shared data requires agreement and, potentially, changes in all or some the functional areas - - this becomes a bigger problem as more functionalities are introduced that have dependency on the shared data. (e.g. popular commercial product such as CRM or ERP)

– ** If the data-store fails, all parties are affected and possibly all functions have to stop** (may need to have 1) redundant db for this architecture style; also, should have 2) good back up- and recovery procedures.)

Page 21: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Event-Driven (Realtime)

• The high level design solution is based on an event dispatcher which manages events and the functionalities which depends on those events. These have the following characteristics:– Events may be a simple notification or may include associated

data

– Events may be prioritized or be based on constraints such as time

– Events may require synchronous or asynchronous processing

– Events may be “registered” or “unregistered” by components

Personal (device)dispatcher

voicecall

textmsg

Image

keypad

Phoneprocessing

Txt processing

Imageprocessing

Problems that fit this architecture includes real-time systems such as: aviation control; medical equipment monitor; home monitor; embedded device controller; game; etc.

- - - try a commercial flight control system - - -

Page 22: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Advantages and Disadvantages ofEvent-Driven

• Advantages:– The event sensors and the event processors are separate,

providing decoupled and individual functionalities. – The replacement and additions are independent and thus

easier to perform– Any sensor or processing malfunction will not affect the

other sensors and processors

• Disadvantages:– It is difficult for the dispatcher to react to a myriad of sensor

inputs and respond in time (especially on simultaneous inputs)- - - the dispatcher is the “single grand connector”

– A dispatcher malfunction will bring the whole system down !!– Dispatcher is very much performance gated (must be fast ---

may be able to use a queue in some cases)

Page 23: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Model-View-Controller (MVC)

• The high level design solution is based on 3 main components:– Models: the portion that handles the data model and the data logic

related to the application functions– View: the component that handles the displaying of information to

the users– Controller: the component that handles the users needs in terms

of accepting the requests and responding to the requests

View model

<< user interface >> << db>>

<< app and db>>

controller

<< user interface>>

vew model

Problems that fit this architecture includes most of the inter-active web-applications.

--Discuss how this can be “adapted” to be shared data, event-driven or layered architecture--

controller

<< app>>

Page 24: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Advantages and Disadvantages ofMVC

• Advantages:– Views, controller, and model are separate components that

allow modification and change in each “layer” without significantly disturbing the other

– The view component, which often needs changes (UI technology improvement) and updates to keep the users continued interests, is separate

– The View-Controller can keep on partially functioning even if the model component is down.

• Disadvantages:– Heavily dependent on the development and production

system environment and tools that match the MVC architecture (e.g. TomCat, .Net, Rail, etc.)

Page 25: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Further Discussion on Software Architecture

We have introduced 5 different software architectural style which described

- the layout of the major components - the interaction among the components

How do you decide on what should be your major components and the layout?

Who provides the mechanisms for the component interactions?

Page 26: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Software Connectors for networked services

• Software connectors form a discrete architectural element that represent a set of mechanisms that enable & mediate component interactions:

– Communications: support transmission of data among components

– Coordination: support transfer of control among components

– Conversion: converts the interaction interface required by one component to that provided by another component

– Facilitation: manage the interaction among the components from deadlocking, from overflow, from unauthorized access, etc.

This is a relatively new field and these definitions are still under study

Page 27: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

A Sample High Level Component Architecture

Component Framework

Component FrameworkApp

CompApp

Comp. . .

AppComp

AppComp. . .

The component framework and the arrowsin this diagram represent the functionalities of software connectors.Examples: DCOM (Microsoft), CORBA (OMG),

.NET (Microsoft), etc.

Page 28: Architecture Architecture is a high level description of a solution to a problem Recall architecture (high level design) includes: 1.Main Components –functionalities

Service Oriented Architecture (SOA)“currently (~ 2010) popular & emerging”

• An architecture that is composed mainly of three “layers”:

1. Networked IT infrastructure (bottom layer)2. Independently developed software & services (middle

layer)3. Coordinated business processes (top layer)

• A distributed architecture based on http/SOAP/WSDL networked services.

• The services are described using XML language to ensure that:

– The business process and procedures match– The exchange of data and the format of the data match

SOAP – Simple Object Access Protocol for exchanges of structured infoWSDL – Web Service Definition Language for defining web services