Top Banner
Map Map Architecture Frameworks Design Patterns
38

Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Mar 31, 2015

Download

Documents

Loren Penington
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

MapMap

Architecture Frameworks

DesignPatterns

Page 2: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

IssuesIssues

Software systems Software systems areare complex and are complex and are only getting more complex. They only getting more complex. They encompass a large amount of detail encompass a large amount of detail and decisions.and decisions.

There is a need to do such things as There is a need to do such things as make decisions about software make decisions about software projects early, to divide work among projects early, to divide work among teams, to ensure certain qualities in the teams, to ensure certain qualities in the

software product.software product.

Page 3: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

ArchitectureArchitecture

When starting the plans for a When starting the plans for a new building, the type of faucets new building, the type of faucets to install on the sinks on the to install on the sinks on the 23rd floor is not a key decision.23rd floor is not a key decision.

Abstraction of detail to focus on Abstraction of detail to focus on the major requirements. the major requirements. Foundation, size, major Foundation, size, major materials needed. Estimates of materials needed. Estimates of

cost and risk.cost and risk.

Page 4: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Software ArchitectureSoftware Architecture

You may have heard of systems as described as You may have heard of systems as described as having a two-tiered architecture or a layered having a two-tiered architecture or a layered architecture.architecture.

Similar notion: abstraction of detail.Similar notion: abstraction of detail. Some questions:Some questions:

– What are the major components of a system and how What are the major components of a system and how do they interact?do they interact?

– What are the major properties of the system?What are the major properties of the system?

Page 5: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

DefinitionDefinition

The structure or structures of the system, which The structure or structures of the system, which comprise software components, the properties of comprise software components, the properties of those components, and the relationships among those components, and the relationships among them. The intent is to provide a basis for decision them. The intent is to provide a basis for decision making and risk reduction without having to making and risk reduction without having to consider all the detail.consider all the detail.

The view from several kilometers up.The view from several kilometers up.

Page 6: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Why is Architecture Important?Why is Architecture Important?

A means of dealing with complexity.A means of dealing with complexity. A basis for decision making.A basis for decision making. Helps to define the properties and Helps to define the properties and

limitations of a system.limitations of a system. Aids long term maintenance. It defines the Aids long term maintenance. It defines the

important components and connections (the important components and connections (the load-bearing walls).load-bearing walls).

Division of effort.Division of effort. Standard patterns and styles.Standard patterns and styles.

Page 7: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Components and ConnectorsComponents and Connectors

Components: computational components.Components: computational components.– Clients, serversClients, servers

– databasesdatabases

– user interfaceuser interface

Connectors: the means by which components Connectors: the means by which components interact.interact.– Procedure callsProcedure calls

– network protocols network protocols

Page 8: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Architectural StylesArchitectural Styles

Systems are often described as having a client-Systems are often described as having a client-server architecture, or a layered architecture, etc. server architecture, or a layered architecture, etc. These are particular styles of architecture.These are particular styles of architecture.

A style is defined by the components, connectors A style is defined by the components, connectors and constraints for a family of architectures.and constraints for a family of architectures.

Each style has particular properties, and knowing Each style has particular properties, and knowing the properties aids in decisions about which style the properties aids in decisions about which style to use. Hybrids are also common.to use. Hybrids are also common.

Examples: pipe and filter, repository, layered.Examples: pipe and filter, repository, layered.

Page 9: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Pipe and FilterPipe and Filter

A component (filter) reads a stream of data on its A component (filter) reads a stream of data on its inputs and produces streams of data on its outputs. inputs and produces streams of data on its outputs. The streams are the pipes.The streams are the pipes.

Filters are independent and do not know the identity of Filters are independent and do not know the identity of upstream or downstream filters.upstream or downstream filters.

Very flexible, good for batch operations.Very flexible, good for batch operations. Example: Unix pipes.Example: Unix pipes.

Page 10: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

RepositoryRepository

Two distinct components:Two distinct components:– a central data repositorya central data repository

– independent components that independent components that operation on the repositoryoperation on the repository

Components may run sequentially Components may run sequentially or be triggered by changes in the or be triggered by changes in the repository. repository.

Examples: compilers, database Examples: compilers, database systemssystems

Repository

Page 11: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Compiler ArchitectureCompiler Architecture

Symbol Table,Parse Tree

Optimization

Translation

Scanner,Parser

Code Generation

Page 12: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Object-Oriented OrganizationObject-Oriented Organization

Components are objects and Components are objects and connectors are procedure calls.connectors are procedure calls.

Objects are responsible for Objects are responsible for maintaining some amount of data maintaining some amount of data or procedure.or procedure.

Objects need to know the identity Objects need to know the identity of all objects they interact with. of all objects they interact with. There is no limit placed on the There is no limit placed on the amount of interconnectedness.amount of interconnectedness.

Object

Object

Object

Object

Page 13: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Layered SystemsLayered Systems

A hierarchy with each layer providing A hierarchy with each layer providing services to the layer above it and services to the layer above it and requesting services from the layer requesting services from the layer below it.below it.

Support increasing levels of abstraction, Support increasing levels of abstraction, which simplifies each layer.which simplifies each layer.

Implementations of the same layer can Implementations of the same layer can be used interchangeably.be used interchangeably.

May have performance problems.May have performance problems.

Page 14: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Modified Three Tier Arch.Modified Three Tier Arch.

User Interface Manager

Workflow Manager

Business Rules Manager

Persistent Object Manager

Database

Generic Services(Error Handling,Authentication)

Client

Server

Database

Page 15: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Where Does Architecture Fit?Where Does Architecture Fit?

Architecture is related to design but is at a higher Architecture is related to design but is at a higher level of abstraction.level of abstraction.

When do you define the architecture?When do you define the architecture?– Since the architecture captures important decisions about Since the architecture captures important decisions about

the structure of the software system, it needs to be the structure of the software system, it needs to be defined early on in the analysis and design phase (at the defined early on in the analysis and design phase (at the same time subsystems are defined).same time subsystems are defined).

– Subsystems are components and connectors.Subsystems are components and connectors.

Defines the interfaces between components, and the Defines the interfaces between components, and the types of connectors.types of connectors.

Page 16: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

CelsiusTech SystemsCelsiusTech Systems Naval product line (SS2000) for command, Naval product line (SS2000) for command,

control and communication.control and communication. Architecture defines one family of Architecture defines one family of

application components which support application components which support multiple ship classes, platforms and multiple ship classes, platforms and operating systems.operating systems.

Lower cost and greater reliability comes Lower cost and greater reliability comes from fitting requirements into the context of from fitting requirements into the context of the product line.the product line.

70% reuse for million plus line systems.70% reuse for million plus line systems.

Page 17: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

ReuseReuse

The example makes the point for not only reusing The example makes the point for not only reusing code components as reuse is typically thought of, code components as reuse is typically thought of, but also reusing a highly configurable architecture but also reusing a highly configurable architecture and design of a system.and design of a system.

Page 18: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

DomainsDomains Functionality that is used across a Functionality that is used across a

spectrum of applications (or spectrum of applications (or subsystems) within a domain can be subsystems) within a domain can be packaged into a single packaged into a single frameworkframework..

Examples:Examples:– MFC in user interfacesMFC in user interfaces

– OSEFA in manufacturing process controlOSEFA in manufacturing process control

– Choices in operating systemsChoices in operating systems

– SEAF in engineering worksheetsSEAF in engineering worksheets

Framework

Applications

Abstraction of common operations.

Page 19: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Object-Oriented FrameworksObject-Oriented Frameworks

Framework: architecture Framework: architecture + implementation + + implementation + hooks.hooks.

The framework serves as The framework serves as the basis for many the basis for many applications. Developers applications. Developers fill in the hooks to fill in the hooks to produce a new app.produce a new app.

Framework

Hooks

Framework

New Applications

Page 20: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

ConceptsConcepts

Applications customize and extend frameworks, Applications customize and extend frameworks, much like a class inherits from it’s parent class.much like a class inherits from it’s parent class.

The architecture and implementation of the The architecture and implementation of the framework impose restrictions on the application.framework impose restrictions on the application.

Framework

Application

Parent

Subclass

Page 21: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Example: GUI BuildersExample: GUI Builders

All window systems come with their own set of All window systems come with their own set of concepts, implementations, and the means by concepts, implementations, and the means by which those concepts interact. which those concepts interact.

Buttons and sliders in windows, menus that Buttons and sliders in windows, menus that generate events, etc.generate events, etc.

By buying into those concepts, user interfaces can By buying into those concepts, user interfaces can be built quickly.be built quickly.

But it’s not for everything:But it’s not for everything:– embedded systems (e.g. robotic soccer players)embedded systems (e.g. robotic soccer players)

– voice controlvoice control

Page 22: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Users and Developers of Users and Developers of FrameworksFrameworks

There are three main roles associated with There are three main roles associated with frameworks:frameworks:– Framework designersFramework designers, also called framework , also called framework

developers or framework builders, develop the original developers or framework builders, develop the original frameworkframework

– Framework usersFramework users, also called framework clients or , also called framework clients or application developers, use the framework to develop application developers, use the framework to develop applications.applications.

– Framework maintainersFramework maintainers refine and redevelop the refine and redevelop the framework to fit new requirements.framework to fit new requirements.

Page 23: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Frameworks and LibrariesFrameworks and Libraries

Applications call library Applications call library functions.functions.

Frameworks call application Frameworks call application extensions. “Don’t call us, extensions. “Don’t call us, we’ll call you.”we’ll call you.”

LibraryApplication

Framework Application

Framework Library

Page 24: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Frameworks vs. ApplicationsFrameworks vs. Applications

Applications:Applications:– are complete, executableare complete, executable

– apply to a single problemapply to a single problem

FrameworksFrameworks– are incomplete, although they may include sample are incomplete, although they may include sample

applicationsapplications

– apply to a range of applications within a domainapply to a range of applications within a domain

Page 25: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Ways to use a FrameworkWays to use a Framework

As is: without any modifications.As is: without any modifications. Complete: add to the framework by filling in parts Complete: add to the framework by filling in parts

left open.left open. Customize: replacing part of the framework with Customize: replacing part of the framework with

custom code.custom code.

Page 26: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Strategies for UseStrategies for Use

Appoint a framework expert. One or two people Appoint a framework expert. One or two people become familiar with the framework and can then become familiar with the framework and can then be consulted during the project.be consulted during the project.

Design integration. It is important to fully Design integration. It is important to fully integrate the design of the application with the integrate the design of the application with the design of the framework during the analysis and design of the framework during the analysis and design phases of development.design phases of development.

Page 27: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Learning to Use the FrameworkLearning to Use the Framework

Frameworks can be difficult to learn so a means of Frameworks can be difficult to learn so a means of lowering the learning curve is needed.lowering the learning curve is needed.– Tutorial sessions can be held to allow the framework Tutorial sessions can be held to allow the framework

builders to show users what can be done with the builders to show users what can be done with the framework.framework.

– Tools can be used to investigate the operation of the Tools can be used to investigate the operation of the framework and to allow the use of the hooks without framework and to allow the use of the hooks without learning the whole framework.learning the whole framework.

– Documentation can describe the design and intended Documentation can describe the design and intended use of the framework, and provide examples of use.use of the framework, and provide examples of use.

Page 28: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

CSF OverviewCSF Overview

Java framework that handles communication Java framework that handles communication between client server or peer to peer programs between client server or peer to peer programs over a TCP/IP network.over a TCP/IP network.

Has some persistent storage capabilities.Has some persistent storage capabilities. Subsystem.Subsystem.

Communication Persistence

Page 29: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Framework ConcernsFramework Concerns

Building a framework requires more resources Building a framework requires more resources than building a single application.than building a single application.

When a framework evolves, all applications built When a framework evolves, all applications built from the framework are affected.from the framework are affected.

A complex framework can take a significant A complex framework can take a significant amount of time to learn before it can be used amount of time to learn before it can be used effectively.effectively.

It isn’t always easy to determine if the framework It isn’t always easy to determine if the framework is compatible with the desired application.is compatible with the desired application.

Page 30: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Framework BenefitsFramework Benefits

Reusable implementation and design that captures Reusable implementation and design that captures the expertise of developers within a domain.the expertise of developers within a domain.

The framework should have a quality design which The framework should have a quality design which will be ‘inherited’ by applications.will be ‘inherited’ by applications.

Decreased development time.Decreased development time. Reduced maintenance costs from maintaining a Reduced maintenance costs from maintaining a

common code base.common code base.

Page 31: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Design PatternsDesign Patterns

Design patterns can and have been used to design Design patterns can and have been used to design object-oriented frameworks. object-oriented frameworks.

A design pattern is a solution to a common A design pattern is a solution to a common software design problem in a given context.software design problem in a given context.– problem: conditions that applyproblem: conditions that apply

– solution: template of classes and collaborationssolution: template of classes and collaborations

– consequences: effect on the overall designconsequences: effect on the overall design

The solutions are not new, but ‘tried and tested.’The solutions are not new, but ‘tried and tested.’

Page 32: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Observer PatternObserver Pattern

Problem: an object needs to monitor Problem: an object needs to monitor the state of another.the state of another.

Solution: make the object an Solution: make the object an observer. observer.

Consequences: Consequences: – simple interface, timely notification, no simple interface, timely notification, no

need for pollingneed for polling

– object must be able to receive updates object must be able to receive updates at any timeat any time

Inbox

notify

Client

update

Subject

Observer

Page 33: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

History of Design PatternsHistory of Design Patterns

Design patterns were inspired by the work of a Design patterns were inspired by the work of a real architect, Alexander, and his book real architect, Alexander, and his book A Timeless A Timeless Way of BuildingWay of Building..

Gamma adapted and applied it to software in his Gamma adapted and applied it to software in his Ph.D. thesis.Ph.D. thesis.

Gamma and three others, Johnson, Helm, Gamma and three others, Johnson, Helm, Vlissides, wrote a book called Vlissides, wrote a book called Design PatternsDesign Patterns which sparked the patterns movement.which sparked the patterns movement.

Page 34: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Patterns and FrameworksPatterns and Frameworks

Design patternsDesign patterns– design level constructsdesign level constructs– small and easily implementedsmall and easily implemented– the user must understand the details of the pattern to use it the user must understand the details of the pattern to use it – used to help design frameworksused to help design frameworks

FrameworksFrameworks– includes both design and implementationincludes both design and implementation– larger and more complex than design patternslarger and more complex than design patterns– the user does not need to understand the framework the user does not need to understand the framework

completelycompletely

Page 35: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Proxy PatternProxy Pattern

Problem: How can data on a server be Problem: How can data on a server be represented at a client without having represented at a client without having to keep a copy of the entire data to keep a copy of the entire data object at the client.object at the client.

Solution: create a proxy of the data Solution: create a proxy of the data on the client side.on the client side.

Consequences:Consequences:– the remote proxy hides the fact that the the remote proxy hides the fact that the

data isn’t localdata isn’t local

– transferring data can occur on demandtransferring data can occur on demand

DataProxy

Client

Data

Page 36: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Composite PatternComposite Pattern

Problem: clients Problem: clients should be able to should be able to ignore the differences ignore the differences between compositions between compositions of objects and of objects and individual objects.individual objects.

Consequences:Consequences:– makes the client simplemakes the client simple

– can be overly generalcan be overly general

Leaf

Operation()

Component

Operation()Add(Component)Remove(Component)GetChild(int)

Operation()Add(Component)Remove(Component)GetChild(int)

Composite

Solution:Solution:

Page 37: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Pattern DescriptionsPattern Descriptions

A full pattern description gives:A full pattern description gives:– motivation for and applicability of the pattern (the motivation for and applicability of the pattern (the

problem in context)problem in context)

– structure, participants and collaborations of the structure, participants and collaborations of the participantsparticipants

– consequences, both good and bad, of using the patternconsequences, both good and bad, of using the pattern

– an example showing the implementation of the patternan example showing the implementation of the pattern

– programs or projects in which it has been usedprograms or projects in which it has been used

– related patternsrelated patterns

Page 38: Map Architecture Frameworks Design Patterns. Issues n Software systems are complex and are only getting more complex. They encompass a large amount of.

Architecture, Frameworks, and Architecture, Frameworks, and Design PatternsDesign Patterns

Architectures are the overall Architectures are the overall high-level structure (components high-level structure (components and connectors) of a system.and connectors) of a system.

Frameworks are reusable Frameworks are reusable designs and implementations of designs and implementations of all or part of an architecture.all or part of an architecture.

Design patterns can be used to Design patterns can be used to help build architectures and help build architectures and frameworks.frameworks.

Architecture

Frameworks

DesignPatterns