design patterns satzinger, jackson, and burd object-orieneted analysis & design

26
Design Patterns Design Patterns Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design

Post on 21-Dec-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

Design PatternsDesign Patterns

Satzinger, Jackson, and Burd

Object-Orieneted Analysis & Design

Summary SlideSummary Slide

Importance of Design Patterns Basic Design Patterns Designing Enterprise-level Systems Differences between client/server and Internet systems UML Notation for Deployment Diagrams Simple Internet Architecture Two-layer Architecture Three-layer Architecture Web Services

Importance of Design PatternsImportance 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

Pattern description for the controller patternPattern description for the controller pattern

Basic Design PatternsBasic 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

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

Singleton PatternSingleton 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

Singleton pattern template Singleton pattern template

Adaptor PatternAdaptor 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

Adapter pattern templateAdapter pattern template

Observer patternObserver pattern

Used to handle event-processing and reduce coupling The domain class

– Allows other classes to “subscribe” as listeners– “Publishes” the changes to the listeners

The windows class – Sends a reference of itself to subscribe as a listener– Implements the method to be invoked when notified

Inherits the method from the listener interface

Figure 9-11 Three classes in the Create new order use case

Figure 9-12 Implementation of the observer pattern

Observer pattern templateObserver pattern template

Designing Enterprise-level SystemsDesigning 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

Differences between client/server and Internet Differences between client/server and Internet systemssystems

UML Notation for Deployment DiagramsUML Notation for Deployment Diagrams

Component– Executable module or program– Has an application program interface (API) that is available to the outside

world Node

– A physical entity at a specific location Frameset

– A high-level object that holds items to be displayed by a browser

UML component notation

UML node notation UML extension for frameset

Simple Internet ArchitectureSimple 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, applets, or

other controls

Simple Internet architecture

Two-layer ArchitectureTwo-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)

Two-layer Internet architecture

Three-layer ArchitectureThree-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

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

Three-layer Internet architecture

Web ServicesWeb Services

A program that provides a service via the Internet The service is posted in a directory so that systems can find it

– Requests for information go to the UDDI directory– UDDI provides the Internet address of a program offering that service– The application then requests the information

All communication is based on XML to allow for generic data exchange

Invoking a Web service