1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

48
1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs

Transcript of 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Page 1: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

1

CS 432 Object-Oriented Analysis and Design

Week 6Design Patterns

Architecture Designs

Page 2: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

2

Use Case ModelRequirements

Analysis Model

Design Model

DeploymentModel

Implementation

Analysis

Design

Implementation

Test

specified by

Test Model

realized by

distributed by

implemented by

verified by

<<trace>>

<<trace>>

<<trace>>

<<trace>>

<<trace>>

Primary Unified Process Models

Deployment

* From Unified Software Development Process [Jacobson, Booch, & Rumbaugh, 1999]

Page 3: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

3

Design Principles-Protection From Variations

Parts of a system that are unlikely to change are segregated from those that will

Drives the multilayer design pattern

Stable business logic can be protected from variations in the user interface

Changes in the business logic are isolated to the controller class

Page 4: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

4

Design Principles-Indirection

Indirection is an implementation of the protection from variations principle

Decouples classes or other system components by placing an intermediate classes between them

Used in many corporate security systems between an internal network and the Internet A proxy server catches all incoming messages

and redistributes them to the recipients

Page 5: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

5

Importance of Design Patterns

Standard design templates can speed OO design

Patterns can exist at different levels of abstraction At the most concrete level, a class definition with

code At the most abstract level, an approach to a

problem Patterns should contain five main elements

Pattern name, problem, solution, example, benefits and consequences

Page 6: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Pattern descriptionfor the controller pattern

Page 7: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

7

Basic Design Patterns

The authors of Elements of Reusable Object-Oriented Software (referred to as the Gang of Four) developed a basic classification scheme for patterns (Figure 9-7)

The 23 GoF patterns are some of the most fundamental and important patterns in use

Scores of other patterns have been defined For example, both Java and .NET have sets of

enterprise patterns

Page 8: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

8 Classification of design patterns

Page 9: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

9

Singleton Pattern

For classes that must have only one instance, but need to be invoked from several classes and locations within the system

The class itself controls the creation of only one instance A static variable of the class refers to the

object that is created A class method instantiates the object on the

first call, and returns a reference to the object on subsequent calls

Page 10: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

10

Singleton Pattern

Page 11: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Singleton pattern template

Page 12: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

12

Adaptor Pattern

Plugs an external class into a system Converts the method calls from within the system

to match the method names in the external class

A standard solution for protection from variations Insulates the system from frequently changing

classes

An interface is frequently used to specify and enforce the use of correct method names

Page 13: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

13

Adapter Pattern

Page 14: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Adapter pattern template

Page 15: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

15

Design Activities in the UP Life Cycle

Page 16: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Design the Support Services Architecture and Deployment

Environment Three organizational dispositions to new

systems Integrate new systems into existing systems Install support services for the first time Replace existing systems

Design issues for all organizations Reliability Security Throughput Synchronization

Page 17: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

17

Design the Software Architecture

Software architecture refers to the “big picture”

Two important aspects Division of software into classes Distribution of classes across processing locations

Modify class diagrams into software classes Determine where classes and objects execute Determine whether they will be distributed Determine communication methods Select programming language(s) to write classes

Page 18: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

18

Design Use Case Realizations

Use case realizations offer a lower-level view Two-tiered focus

Class interactions supporting a particular use case Interactions among software, users, and external

systems

Design typically spread over many iterations UML design class diagrams and interaction

diagrams document design

Page 19: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

19

Design the Database

Designing database as a key design activity

Physical model of database based on class diagram

Physical model describes relational or OO database

Some technical issues Performance, such as response time

Integration with existing databases

Legacy databases

Page 20: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

20

Design the System and User Interfaces

System interface issues Different types of systems will interface Systems interact with internal and external

users User interface issues

User capabilities and needs differ widely User interacts with the system in different ways Approaches to interface vary by system Has nature of interface emerged from earlier

models?

Page 21: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

21

Design the System Security and Controls

User-interface controls limit access to authorized users

System interface controls protect system from other systems

Application controls record transactions and validate work

Database controls ensure data protected from unauthorized access and accidental loss

Network controls protect network communication

Page 22: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

22

Design Activities and the UP

Focus in early iterations of elaboration phase System architecture and databases

Evenly distributed throughout project Detailed design activities

Criteria analyst uses to schedule design activities Experience Forecasting capabilities

Every design impacts other parts of system

Page 23: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

23

Single-Computer and Multitier Architecture

Single-computer architecture Single system attached to peripheral

devices PC and mainframe applications qualify Advantages: easy to design, build,

operate, maintain Disadvantages: capacity limits

Page 24: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Single-computer, Clustered, and Multicomputer Architectures

Page 25: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

25

Single-Computer and Multitier Architecture

(continued)

Multitier architecture (multiple computer systems) Clustered architecture

Group of computers logically operate as one

Nodes from same manufacturer and model family

Multicomputer architecture Cluster whose nodes are optimized or specialized

Hardware and operating systems may be dissimilar

Page 26: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

26

Centralized and Distributed Architecture

Centralized architecture Deploys computer systems in single location Used for large-scale processing applications Constraint: geography Implements subsystems in larger information system

Distributed architecture Software/data spread across systems and locations Relies on communication networks to interconnect

Page 27: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

27

Client/Server Architecture

Client/server architecture tiers Client: requests resources or services from a server Server: manages information system resources

Architectural issues for client/server software: Decomposing software into client and server programs

(objects) Determining where clients and servers will execute Describing interconnection protocols and networks

Page 28: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Client/Server Architecture with a Shared Database

Page 29: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

29

Client/Server Architecture(continued)

Client and server communicate via well-defined protocols over a physical network

Client/server architecture advantages Location flexibility, scalability, maintainability

Client/server architecture disadvantages Additional complexity, potential poor

performance, security issues, and reliability 

Page 30: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Interaction Among Multiple Clients and a Single Server

Page 31: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

31

Three-Layer Client/Server Architecture

Variant of client/server architecture Divides application software into independent

processes Three-layers

The data layer The business logic layer The view (presentation) layer

Three-tier architecture advantages Additional flexibility and reliability

Page 32: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

32

Three-Tier Logical Layers

Page 33: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

33

Three-Tier Architecture

Page 34: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

34

Four-Tier Architecture

Page 35: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

35

Model-View-Controller (MVC)Design Pattern or Framework

Page 36: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

36

Middleware

Middleware Connects parts of an application Enables requests and data to pass among them

Common types of middleware Teleprocessing monitors Transaction processing monitors Object request brokers (ORBs)

Each type of middleware has its own set of protocols

Page 37: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Differences between client/server and Internet systems

Page 38: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

38

Web Client/Server Architecture

Page 39: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

39

Internet and Web-Based Software Architecture

Web is complex example of client/server architecture Web resources are managed by server processes Clients are programs that send requests to

servers Web protocols define valid resource formats and

communication standards Web-like capabilities embedded in ordinary

applications Web-oriented client/server architecture:

service-oriented architecture (SOA)  

Page 40: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

40

Internet and Web-Based Software Architecture (continued)

Flexibility is the key to the Internet alternative Accessibility, low cost communication, widely used

standards Disadvantages of Web technologies

Security, reliability, throughput, and volatile standards

The key architectural design issues Defining client and server processes or objects Distributing processes across hardware platforms Connecting processes

Page 41: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

41

Simple Internet Architecture

Used for viewing static information The browser component executes on the

client computer The Internet server component executes

on the server computer Pages reside on the server and are sent to

the browser for display Program logic is inserted through scripting

languages (JavaScript, VBScript), applets, or other controls

Page 42: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Simple Internet architecture

Page 43: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

43

Two-layer Architecture

Primarily captures information from the user and updates the database

The domain layer and data access layer are usually combined

Input data is sent to a CGI or an application server

The user-interface classes often contain the business logic and data access Processing takes place with servlets (Java) or

code behind classes (.NET)

Page 44: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Two-layer Internet architecture

Page 45: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

45

Three-layer Architecture Separates domain layer and data access layers Necessary for systems with complex business

logic or multiple user interfaces Using CGI

Provide a use case controller for each form that distributes messages to the individual objects of the system.

Using an application server Java tools: Java Server Pages and servlets .NET tools: Common Runtime Language and code

behind classes

Page 46: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Three-layer Internet architecture

Page 47: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

Invoking a Web service

Page 48: 1 CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs.

48

Designing Enterprise-level Systems

Enterprise-level systems share components among multiple people or groups in an organization

Enterprise-level systems almost always use multiple tiers of computers

Can be client/server network-based or Internet based

Designed with deployment diagrams A type of implementation diagram that shows

physical components across different locations