58
Software Architecture Feng Zhiyong Tianjin Universit y March 1, 2006

Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Embed Size (px)

Citation preview

Page 1: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Software Architecture

Feng Zhiyong

Tianjin University

March 1, 2006

Page 2: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Course Overview

Instructor: Professor Zhiyong Feng, Department of Computer Science and Technology

Marking Scheme: One paper(40%), One project(60%)

Page 3: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Textbooks

Mary Shaw and David Garlan, Software Architecture: Perspectives on an Emerging Discipline, Prentice Hall, 1996

Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley, 1995

Bruce Eckel, Thinking in Java, Prentice Hall, May 2000 (can be downloaded free)

Grady Booch, Object-Oriented Analysis and Design with Applications, 2nd ed, Addison-Wesley, 1994

Page 4: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

CHAPTER 1: Introduction

The civil architecture Software architecture Architecture and UML Architecture and software engineering

process Architecture design The future of architecture

Page 5: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecting a dog house

Can be built by one personRequires

Minimal modelingSimple processSimple tools

Page 6: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecting a house

Built most efficiently and timely by a teamRequires

ModelingWell-defined processPower tools

Page 7: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecting a high rise

Page 8: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Early architecture

Progress - Limited knowledge of theory

Page 9: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Modern architecture

Progress - Advances in materials - Advances in analysis

Scale - 5 times the span of the Pantheon - 3 times the height of Cheops

Page 10: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Modeling a house

Page 11: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Movements in civil architecture

Bronze age/Egyptian (Imhotep) Grecian/Roman (Vitruvius) Byzantine/Romanesque Gothic Mannerism (Michelangelo, Palladio) Baroque Engineering/Rational/National/Romantic Art noveau Modern movement (Wright, LeCorbusier)

Progress - Imitation of previous efforts - Learning from failure - Integration of other forces - Experimentation

Page 12: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Kinds of civil architecture

Community– houses, flats and apartments, gardens,

education, hospitals, religion

Commerce– shops and stores, restaurants, hotels, office

buildings, banks, airports

Industry– industrial buildings, laboratories, farm buildings

Leisure– sport, theaters and cinemas, museums

Neufert Architect’s DataThe Handbook of Building Types

Page 13: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Forces in civil architecture

Avoiding failure - Safety factors - Redundancy - Equilibrium

Compression

Load

Tension

Load

Kinds of loads - Dead loads - Live loads - Dynamic loads

Any time you depart from established practice, make ten times the effort, ten times the investigation. Especially on a very large project. - LeMessuier

Page 14: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Dimensions of software complexity

Higher technical complexity - Embedded, real-time, distributed, fault-tolerant - Custom, unprecedented, architecture reengineering - High performance

Lower technical complexity - Mostly 4GL, or component-based - Application reengineering - Interactive performance

Highermanagement complexity - Large scale - Contractual - Many stake holders - “Projects”

Lowermanagement complexity - Small scale - Informal - Single stakeholder - “Products”

Defense MIS System

Defense Weapon SystemTelecom

Switch

CASE Tool

National Air TrafficControl System

Enterprise IS(Family of ISApplications)

CommercialCompiler

BusinessSpreadsheet

IS ApplicationDistributed Objects

(Order Entry)

Small ScientificSimulation

Large-ScaleOrganization/Entity

Simulation

An average software project: - 5-10 people - 10-15 month duration - 3-5 external interfaces - Some unknowns & risks Embedded

Automotive Software

IS ApplicationGUI/RDB

(Order Entry)

Walker Royce

Page 15: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Forces in Software

Technology churnOur enemy is complexity, and it’s our goal to kill it.Jan Baan

Performance Throughput

Capacity

Availability

Fail safe

Fault tolerance

FunctionalityCost Compatibility

Resilience

The challenge over the next 20 years will not be speed or cost or performance;it will be a question of complexity.Bill Raduchel, Chief Strategy Officer, Sun Microsystems

Page 16: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

The domain of architecting

The “what” The “why”

ArchitectureQualities

Process

Architecture Representation

The “how”The “who”

SystemFeatures

Architecture Requirements

SystemQuality Attributes

Satisfies

Constrain

Organization

Architect

Skills

StakeholdersDefines role

Produces

Follows

DefinesTechnology

Wojtek Kozaczynski

Page 17: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

We all know that ...

Architecture and design are the same thingArchitecture and infrastructure are the same thing<my favorite technology> is the architectureA good architecture is the work of a single architectArchitecture is flat, one blueprint is enoughArchitecture is just structureSystem architecture precedes software architectureArchitecture cannot be measured and validatedArchitecture is a ScienceArchitecture is an Art

Philippe Kruchten

Page 18: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture defined (again)

Architecture n (1555)

1: the art of science of building, specifically, the art or practice of designing and building structures and esp. habitable ones

2 a: formation or construction as or as if as the result of conscious act <the ~ of the garden> b: a unifying or coherent form or structure <the novel lacks ~>

Merriam Webster’s Collegiate Dictionary10th edition

Page 19: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture defined (yet again)

Software architecture encompasses the set of significant decisions about the organization of a software system– selection of the structural elements and their

interfaces by which a system is composed– behavior as specified in collaborations among

those elements– composition of these structural and behavioral

elements into larger subsystem– architectural style that guides this organization

Mary Shaw, CMUGrady Booch,

Philippe Kruchten,Rich Reitman

Kurt Bittner, Rational

Page 20: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture defined (continued)

Software architecture also involves– usage– functionality– performance– resilience– reuse– comprehensibility– economic and technology constraints and

tradeoffs– aesthetic concerns

Mary Shaw, CMUGrady Booch,

Philippe Kruchten,Rich Reitman

Kurt Bittner, Rational

Page 21: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture metamodel

Software Architecture

Software Architecture Description

Architectural view

is made of

is represented by

Architecture Design Process

produces

Form

Component

Connection

Architectural Pattern

is a

is made of

Software Architects

are actors in

Logical view

Process view

Implemen- tation view

Deployment view

Requirements

satisfies

Architectural style

has

has

has

is a

System architecture

is part of

Architecture Style guide

Constraints

constrains

constrains

Use case view

relates to

Architectural Blueprint

depicts

Page 22: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Models

Models are the language of designer, in many disciplines

Models are representations of the system to-be-built or as-built

Models are vehicle for communications with various stakeholders

Visual models, blueprints Scale Models allow reasoning about some

characteristic of the real system

Page 23: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Many stakeholders, many views

Architecture is many things to many different interested parties

– end-user– customer– project manager– system engineer– developer– architect– maintainer– other developers

Multidimensional reality Multiple stakeholders

multiple views, multiple blueprints

Page 24: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural view

An architectural view is a simplified description (an abstraction) of a system from a particular perspective or vantage point, covering particular concerns, and omitting entities that are not relevant to this perspective

Page 25: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecturally significant elements

Not all design is architecture

Main “business” classes Important mechanisms Processors and processes Layers and subsystems

Architectural views = slices through models

Page 26: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Characteristics of a Good Architecture

Resilient Simple Approachable Clear separation of concerns Balanced distribution of responsibilities Balances economic and technology

constraints

Page 27: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Representing System Architecture

Logical View

End-user Functionality

Implementation View

Programmers Software management

Process View

PerformanceScalabilityThroughput

System integrators

Deployment View

System topology Delivery, installation

Communication

System engineering

Conceptual Physical

Use Case View

Page 28: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Relation Between Views

Logical view Component view

Process view

Deployment view

Page 29: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

How many views?

Simplified models to fit the context

Not all systems require all views:

– Single processor: drop deployment view

– Single process: drop process view

– Very Small program: drop implementation view

Adding views:

– Data view, security view

Page 30: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture and the UML

OrganizationPackage, subsystem

DynamicsInteractionState machine

Design View Implementation View

Process View

Components Classes, interfaces,collaborations

Active classes

Deployment View

Nodes

Use Case ViewUse cases

Page 31: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Software engineering process

A set of partially ordered steps intended to reach a goal. In software engineering the goal is to build a software product or to enhance an existing one.

Architectural process– Sequence of activities that lead to the production

of architectural artifacts: A software architecture description An architectural prototype

Page 32: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Rational Unified Process

Iterative Architecture-centric Use-case driven Risk confronting

Page 33: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Focus over time

Discovery Invention

Focus

Implementation

Page 34: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Key concepts

Phase, Iterations

Process Workflows– Activity, steps

Artifacts– models

– reports, documents

Worker: Architect

What does What does happen?happen?

What is What is produced?produced?

Who does Who does it?it?

When does When does architecture happen?architecture happen?

Page 35: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Lifecycle Phases

time

Inception Elaboration Construction Transition

Inception Define the scope of the project and develop business case

Elaboration Plan project, specify features, and baseline the architecture

Construction Build the product

Transition Transition the product to its users

Page 36: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Major Milestones

time

Vision Baseline Architecture

InitialCapability

Product Release

Inception Elaboration Construction Transition

Page 37: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Phases and Iterations

An iteration is a sequence of activities with an established plan and evaluation criteria, resulting in an executable release

ArchIteration

... Dev Iteration

Dev Iteration

... TransIteration

...Release Release Release Release Release Release Release Release

PrelimIteration

...

Inception Elaboration Construction Transition

Page 38: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture-Centric

Models are vehicles for visualizing, specifying, constructing, and documenting architecture

The Unified Process prescribes the successive refinement of an executable architecture

time

Architecture

Inception Elaboration Construction Transition

Page 39: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Unified Process structure

ManagementEnvironment

Business Modeling

Implementation

Test

Analysis & Design

Preliminary Iteration(s)

Iter.#1

PhasesProcess Workflows

Iterations

Supporting Workflows

Iter.#2

Iter.#n

Iter.#n+1

Iter.#n+2

Iter.#m

Iter.#m+1

Deployment

Configuration Mgmt

Requirements

Elaboration TransitionInception Construction

Page 40: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture and Iterations

Use caseModel

DesignModel

DeploymentModel

TestModel

ImplementationModel

Content

Page 41: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural design

Identify, select, and validate “architecturally significant” elements

Not everything is architecture– Main “business” classes– Important mechanisms– Processors and processes– Layers and subsystems– Interfaces

Produce a Software Architecture Document

Page 42: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural design workflow

Select scenarios: criticality and risk Identify main classes and their responsibility

Distribute behavior on classes Structure in subsystems, layers,

define interfaces Define distribution and concurrency Implement architectural prototype Derive tests from use cases Evaluate architecture

Iterate

Use case view

Logical view

Deployment view

Implementation view

Process view

Page 43: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Sources of architecture

Theft

Method

Intuition

Classical system Unprecedented system

Theft

Method

Intuition

Page 44: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

From Programming Languages to Software Architecture

High-level Programming Languages– Data type, modules, data structures

Abstract Data Types– the software structure (which included a representation packaged

with its primitive operators),– specifications (mathematically expressed as abstract models or

algebraic axioms),– language issues (modules, scope, user-defined types),– integrity of the result (invariants of data structures and protection

from other manipulation),– rules for combining types (declarations),– information hiding (protection of properties not explicitly included in

specifications). Software Architecture

– Architecture style– Design patterns

Page 45: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural style

An architecture style defines a family of systems in terms of a pattern of structural organization.

An architectural style defines– a vocabulary of components and connector types– a set of constraints on how they can be

combined– one or more semantic models that specify how a

system’s overall properties can be determined from the properties of its parts

Mary Shaw, CMU

Page 46: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural style (cont.)

What is the structural pattern—the components, connectors, and constraints?

What is the underlying computational model? What are the essential invariants of the style? What are some common examples of its use? What are the advantages and disadvantages

of using that style? What are some of the common

specializations?

Mary Shaw, CMU

Page 47: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Patterns

A pattern is a solution to a problem in a context

A pattern codifies specific knowledge collected from experience in a domain

All well-structured systems are full of patterns

– Idioms– Design patterns– Architectural patterns

Page 48: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Design patterns

Creational patterns– Abstract factory– Prototype

Structural patterns– Adapter– Bridge– Proxy

Behavioral patterns– Chain of responsibility– Mediator– Visitor

Mechanisms are the soul of an architecture

Design PatternsGamma et al

Page 49: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architectural patterns

Distributed Layered Event-driven MVC Frame-based IR-centric Batch Subsumption Pipes and filters Disposable Repository-centric Blackboard Interpreter Rule-based

Software ArchitectureShaw and GarlanBuschmann et al

A System of PatternsBuschman et al

Booch

Page 50: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Complex business system

Real-Life Object-oriented SystemsSoren Lauesen

SQL Database

Middle layer

GUI layer

ServiceAgent

purchase(customer, product, items)

Customer

name : StringAddress : String

save()

Customer

name : StringAddress : String

save()getName()updateName()

Customer Order Line

**

Product

**

Order Line

items : Product

getName()updateName()

Observer

update()

Order

date : Date

Product

name : Stringprice : Currency

getName()updateName()

Sales

product : Product

Page 51: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Logical application architecture

RelationalDatabase

GraphicalUserInterface

RelationalDatabase

GraphicalUserInterface

BusinessObjectModel

GraphicalUserInterface

BusinessObjectModel

RelationalDatabase

Page 52: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Physical application architecture

Relational Database Server(s)

Client CWWW Browser

WebServer

HTMLCGI

ASP Java

Business ObjectServices

Business ObjectEngine

Application

Business ObjectServices

Client A

Business ObjectEngine

Thinner client, thicker server

Client BApplication

Business ObjectServices

Business ObjectEngine

Business Object Server

DCOMADO/R

CORBA Beans

COMMTS

BeansETS

Page 53: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Complex Internet system

The Second WavePaul Dreyfus, Netscape

Client

Server

ApplicationServer

FulfillmentSystem

FinancialSystem

InventorySystem

RDBMSServer

Dynamic HTML, JavaScript, Javaplug-ins, source code enhancements

Java, C, C++, JavaScript, CGI

Java, C, C++, JavaBeans, CORBA, DCOM

Native languages

Page 54: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Who are the architects?

Experience– software development– domain

Pro-active, goal oriented Leadership, authority Architecture team

– balance

Page 55: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architect

Not just a top level designer Need to ensure feasibility

Not the project manager But “joined at the hip”

Not a technology expert Purpose of the system, “fit”,

Not a lone scientist Communicator

Page 56: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Software architecture team charter

Defining the architecture of the software Maintaining the architectural integrity of the

software Assessing technical risks related to the

software design Proposing the order and contents of the

successive iterations Consulting services Assisting marketing for future product definition Facilitating communications between project

teams

Page 57: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Architecture is making decisions

The life of a software architect is a long (and sometimes painful) succession of suboptimal decisions made partly in the dark.

Page 58: Software Architecture Feng Zhiyong Tianjin University March 1, 2006

Futures

ADL: Architecture Description Languages– UML, UniCon, LILEAnna, P++, LEAP, Wright,

µRapid

Standardization of concepts– IEEE Working Group on Architecture– INCOSE Working Group on System Architecture

Systematic capture of architectural patterns