cs5103 software engineering lecture 07 software architecture

42
CS5103 Software Engineering Lecture 07 Software Architecture

Upload: mervin-webb

Post on 23-Dec-2015

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS5103 Software Engineering Lecture 07 Software Architecture

CS5103 Software

Engineering

Lecture 07Software Architecture

Page 2: CS5103 Software Engineering Lecture 07 Software Architecture

2

Today’s class

Software Architecture What is software architecture

Why software architecture

Software architecture styles

Page 3: CS5103 Software Engineering Lecture 07 Software Architecture

3

What is software architecture

Software architecture is the structure of a software system – like the blue prints in building architecture Software components Details (data structure and algorithms) hidden Relationships among the components Relations can be vague

Data flows Control flows Dependencies

Page 4: CS5103 Software Engineering Lecture 07 Software Architecture

4

Why software architecture?

Software becomes larger and larger 500 lines of code: just write it

5,000 lines of code: maybe class diagram (data flow diagram for non OO approaches)

500,000 lines of code: software architecture

Page 5: CS5103 Software Engineering Lecture 07 Software Architecture

5

A simple class diagram

Page 6: CS5103 Software Engineering Lecture 07 Software Architecture

6

A class diagram with 300 classes

Page 7: CS5103 Software Engineering Lecture 07 Software Architecture

7

So we need higher level abstraction

Consider higher level concepts in architecture : components

For OO approach, components are usually a collection of classes

Consider the bookstore project: For a small book store: books, shelves, clerks But for barnes&noble: book storage, ads,

finance, online stores, readers, bookstore is one component

Page 8: CS5103 Software Engineering Lecture 07 Software Architecture

8

Software Architectural Design

Usually used for large software projects and software frameworks

Early phase design Important for task assignment

At a higher level than class diagrams Components and their relationship

Interface can be vague at first

Page 9: CS5103 Software Engineering Lecture 07 Software Architecture

9

Software Architectural Design

Usually done by a small number of high-level people

It can be both technical and artistic

Experience and creativity can be major factors

It is not something you can learn well from the book

But there is something to learn about it

Page 10: CS5103 Software Engineering Lecture 07 Software Architecture

10

Software architecture styles

Something like architecture styles for buildings Certain way to organize components and

their relationships

Can be reused in different software

Use different architecture styles according to the usages of software

Page 11: CS5103 Software Engineering Lecture 07 Software Architecture

11

Architecture styles

Stadium

Page 12: CS5103 Software Engineering Lecture 07 Software Architecture

12

Architecture styles

Stations and airports

Page 13: CS5103 Software Engineering Lecture 07 Software Architecture

13

Architecture styles

Skyscrapers

Why no skyscrapers

looking like a stadium?

Page 14: CS5103 Software Engineering Lecture 07 Software Architecture

14

Some times people try new styles…

Page 15: CS5103 Software Engineering Lecture 07 Software Architecture

15

Why Software architecture styles

Easier to do high level design Barnes&Noble example

Consider an architecture like this:

Component

Component

Component

Component

Component

Component

Page 16: CS5103 Software Engineering Lecture 07 Software Architecture

16

Why Software architecture styles

Actually, most such information systems has an architecture like this, why?

Component Component ComponentComponent

ComponentComponent

ComponentData

Service

Application

Page 17: CS5103 Software Engineering Lecture 07 Software Architecture

Why Software architecture styles

Reduce high level design risks People may have tried different styles and found

this best (It is not as obvious as for buildings)

The drawbacks of commonly used architectures are well studied

You may try new ones:

But not until you

are a really good

architect

Page 18: CS5103 Software Engineering Lecture 07 Software Architecture

Popular architecture styles

Pipe and Filter Layered Repository

Page 19: CS5103 Software Engineering Lecture 07 Software Architecture

19

Pipe and Filter

A defined series of independent computations Performed for data transformation

A component reads streams of data on its inputs and produces streams of data on its outputs

Page 20: CS5103 Software Engineering Lecture 07 Software Architecture

UTSA CS377320

Pipe and Filter

Page 21: CS5103 Software Engineering Lecture 07 Software Architecture

Pipe and Filter: Structure

Components: filter Perform changes on the data input and

generate output

Computation can be done with part of input, so that it can start before accepting all inputs

Connectors: pipe Simply data transfer between filters

Page 22: CS5103 Software Engineering Lecture 07 Software Architecture

22

Pipe and Filter: Characteristic

Filters do not share state with other filters Filters do not know the identity of their

upstream or downstream filters The correctness of the output of a pipe and filter

network shall not depend on the order in which their filters perform their incremental processing

Page 23: CS5103 Software Engineering Lecture 07 Software Architecture

23

Pipe and Filter Examples

Unix Shell Scripts: provides a notation for connecting Unix processes via pipes.e.g., cat file | grep err | wc

Compilers: the phases in the pipeline include: Lexical analysis Parsing Semantic analysis Code generation

Page 24: CS5103 Software Engineering Lecture 07 Software Architecture

24

Pipe and Filter - Advantages

Easy to understand the overall input/output behavior of a system as a simple composition of the behaviors of the individual filters

They support reuse, since any two filters can be hooked together, provided they agree on the data that is being transmitted between them

Page 25: CS5103 Software Engineering Lecture 07 Software Architecture

25

Pipe and Filter - Advantages

Systems can be easily maintained and enhanced, since new filters can be added to existing systems and old filters can be replaced by improved ones

The naturally support concurrent execution: map-reduce is actually pipe and filter architecture

Page 26: CS5103 Software Engineering Lecture 07 Software Architecture

26

Pipe and Filter - Disadvantages

Not good for handling reactive systems, because of their transformational character

Excessive parsing and un-parsing leads to loss of performance and increased complexity in writing the filters themselves

Page 27: CS5103 Software Engineering Lecture 07 Software Architecture

27

Layered Style

The system is divided to multiple layers

Each layer provides service to the layer above it and serves as a client to the layer below it

Each layer may have multiple components, these components usually do not interact much with each other

Page 28: CS5103 Software Engineering Lecture 07 Software Architecture

28

Layered Style

Page 29: CS5103 Software Engineering Lecture 07 Software Architecture

29

Layered Style: Structure

Components: are typically collections of procedures

Connectors: the layer margin, are typically procedure calls under restricted visibility

Layer Communication Rules: Usually a component will talk only with the layer

just beneath it Only carefully selected procedures from the inner

layers are made available (exported) to their adjacent outer layer

Page 30: CS5103 Software Engineering Lecture 07 Software Architecture

30

Layered Style Examples

Operating Systems Unix Windows Android …(almost any)

Distributed Information Systems Web applications

Data/Logic/Appearance

Page 31: CS5103 Software Engineering Lecture 07 Software Architecture

31

Layered Style Advantages

Design: based on increasing levels of abstraction

Maintainability: changes to the function of one layer affects at most two other layers

Reuse: different implementations (with identical interfaces) of the same layer can be used interchangeably

Page 32: CS5103 Software Engineering Lecture 07 Software Architecture

32

Layered Style Disadvantages

Not all systems are easily structured in a layered fashion

Performance requirements may force the coupling of high-level functions to their lower-level implementations

Page 33: CS5103 Software Engineering Lecture 07 Software Architecture

33

Repository Style

Suitable for applications in which the central issue is establishing, augmenting, and maintaining a complex central body of information

Typically the information must be manipulated in a variety of ways

Often long-term persistence of information is required

Page 34: CS5103 Software Engineering Lecture 07 Software Architecture

34

Repository Style

Page 35: CS5103 Software Engineering Lecture 07 Software Architecture

35

Repository Style: Structure

Components: A central data structure representing the

correct state of the system A collection of independent components that

operate on the central data structure Connectors:

Typically procedure calls or direct memory accesses

Page 36: CS5103 Software Engineering Lecture 07 Software Architecture

36

Repository Style: Characteristics

Components only interact with the repository All components can access the repository The repository controls and manages the access

to its data

Page 37: CS5103 Software Engineering Lecture 07 Software Architecture

37

Repository Style Examples

Programming Environments Graphical Editors AI Knowledge Bases

Page 38: CS5103 Software Engineering Lecture 07 Software Architecture

38

Repository Style Advantages

Efficient way to store large amounts of data Sharing model is published as the repository

schema Centralized management:

backup security concurrency control

Page 39: CS5103 Software Engineering Lecture 07 Software Architecture

39

Repository Style Disadvantages

Must agree on a data model a prior Difficult to distribute data Data evolution is expensive

Page 40: CS5103 Software Engineering Lecture 07 Software Architecture

40

Today’s class

UML Sequence Diagram

Software Architecture What is architecture

Why architecture

Architecture styles

Page 41: CS5103 Software Engineering Lecture 07 Software Architecture

41

Next class

Software Design Principles Design Patterns

Definition

Reasons and Advantages

Some Useful design patterns Composite Factory Visitor

Page 42: CS5103 Software Engineering Lecture 07 Software Architecture

42

Thanks!