+ All Categories
Home > Documents > Final sdp ppt

Final sdp ppt

Date post: 09-Jul-2015
Category:
Upload: nancy17
View: 193 times
Download: 0 times
Share this document with a friend
Popular Tags:
25
SOFTWARE DESIGN PATTERNS By:- NANCY GOEL USN-1MS09IS059 M.S.RAMIAH INSTITUTE OF TECHNOLOGY INFORMATION SCIENCE AND ENGINEERING 1
Transcript
Page 1: Final sdp ppt

SOFTWARE DESIGN

PATTERNS

By:-

NANCY GOEL

USN-1MS09IS059

M.S.RAMIAH INSTITUTE OF TECHNOLOGY

INFORMATION SCIENCE AND ENGINEERING

1

Page 2: Final sdp ppt

INTRODUCTION

A design pattern is a descriptions of

communicating objects and classes that are

customized to solve a general design problem in a

particular context.

“Each pattern describes a problem which occurs

over and over again in our environment and then

describes the core of the solution to that

problem, in such a way that you can use this

solution a million times over, without ever doing it

in the same way twice”

2

Page 3: Final sdp ppt

CONTD…

A pattern is a recurring solution to a standard

problem.

Patterns capture the static and dynamic structure

and collaboration among key participants in software

designs

A pattern is made by four elements:

• name

• problem

• solution

• consequences

3

Page 4: Final sdp ppt

NAME OF DESIGN PATTERN

Describe a design problems and its solutions in a

word or two.

Used to talk about design pattern with our

colleagues.

Used in the documentation.

Increase our design vocabulary.

Have to be coherent and evocative.4

Page 5: Final sdp ppt

PROBLEM

Describes when to apply the patterns.

Explains the problem and its context.

Sometimes include a list of conditions that

must be met before it makes sense to apply the

pattern.

Have to occur over and over again in our

environment.

5

Page 6: Final sdp ppt

SOLUTION

Describes the elements that make up the

design, their relationships, responsibilities and

collaborations.

Does not describe a concrete design or

implementation.

Has to be well proven in some projects.

6

Page 7: Final sdp ppt

CONSEQUENCES

Results and trade-offs of applying the pattern.

Helpful for describe design decisions, for

evaluating design alternatives.

Benefits of applying a pattern.

Impacts on a system’s flexibility , extensibility or

portability.

7

Page 8: Final sdp ppt

DESCRIPTION OF DESIGN

PATTERN

Pattern name and classification

Intent

Participants

Collaborations

Consequences

Implementation

Design

8

Page 9: Final sdp ppt

TYPES OF PATTERNS

Creational patterns:

Abstract the instantiation process

Make a system independent to its

realization

Class Creational use inheritance to vary

the instantiated classes

Object Creational delegate instantiation to

an another object

9

Page 10: Final sdp ppt

CONTD…

Structural patterns:

Class Structural patterns concern the

aggregation of classes to form largest

structures

Object Structural pattern concern the

aggregation of objects to form largest

structures10

Page 11: Final sdp ppt

CONTD…

Behavioral patterns:

Concern with algorithms and assignment of

responsibilities between objects

Describe the patterns of communication

between classes or objects

Behavioral class pattern use inheritance to

distribute behavior between classes

Behavioral object pattern use object

composition to distribute behavior between

classes11

Page 12: Final sdp ppt

CREATIONAL PATTERN

Singleton Ensure a class only has one instance

Provide a global point of access to it

Abstract Factory

• Provide an interface for creating families

of related or dependent objects without

specifying their concrete classes

12

Page 13: Final sdp ppt

CONTD…

Factory Method Define an interface for creating an object

but let subclasses decide which class to

instantiate

Lets a class defer instantiation to

subclasses

13

Page 14: Final sdp ppt

STRUCTURAL PATTERN

Decorator Attach additional responsibilities to an object

dynamically

Provide a flexible alternative to sub classing for

extending functionality

Adapter Convert the interface of a class into another

interface clients expect

Lets classes work together that couldn’t

otherwise because of incompatible interfaces 14

Page 15: Final sdp ppt

CONTD…

Bridge• Decouple an abstraction from its

implementation so that the two can vary

independently

Façade Provide a unified interface to a set of

interfaces in a subsystem

Defines an higher-level interface that

makes the system easier to use15

Page 16: Final sdp ppt

BEHAVIORAL PATTERN

Observer Define a one-to-many dependency

between objects so when one of them change state all its dependents are updated automatically

Strategy Define a family of algorithms

Encapsulate each one

Make them interchangeable

Lets the algorithms vary independently from clients that use it 16

Page 17: Final sdp ppt

DECORATOR PATTERN

Motivation

Add responsibilities to individual object

not to an entire class

conforming the interface of the

component decorated

17

Page 18: Final sdp ppt

CONTD...

Structure Component

Operation()

ConcreteComponent

Operation()

Decorator

Operation()

ConcreteDecoratorAOperation()AddedState

ConcreteDecoratorBOperation()Addedbehavior 18

Page 19: Final sdp ppt

CONTD…

Participants Component

Define the interface for objects that can have responsibilities added to them dinamically

Concrete ComponentDefines an object to which additional

responsibilities can be attached

DecoratorMantains a reference to a Component object and

defines an interface that conforms to Component’s interface

ConcreteDecoratorAdded responsibilities to the component 19

Page 20: Final sdp ppt

CONTD…

Consequences

More flexibility than static inheritance

Avoids feature-laden classes high up in

the hierarchy

A decorator and its component are not

identical

Lots of little objects

20

Page 21: Final sdp ppt

CONTD…

Motivation If you have a TextView object that

displays text in a Window

TextView has no scroll bars by default

TextView has no bord by default …

21

Page 22: Final sdp ppt

EXAMPLE

StructureVisualComponent

Draw()

TextView

Draw()

Decorator

Draw()

ScrollDecorator BorderDecorator

Draw()ScrollTo()

ScrollPosition

Draw()DrawBorder()

BorderWidth22

Page 23: Final sdp ppt

BENEFITS OF DESIGN PATTERNS

Design patterns enable large-scale reuse of

software architectures and also help document

systems

Patterns explicitly capture expert knowledge and

design tradeoffs and make it more widely available

Patterns help improve developer communication

Pattern names form a common vocabulary

23

Page 24: Final sdp ppt

DRAWBACKS TO DESIGN PATTERNS

Patterns do not lead to direct code reuse

Patterns are deceptively simple

Teams may suffer from pattern overload

Patterns are validated by experience and

discussion rather than by automated testing

Integrating patterns into a software development

process is a human-intensive activity.

24

Page 25: Final sdp ppt

THANK

YOU!!!!!!

25


Recommended