Professional Documents
Culture Documents
Unit I
Unit I
S.NO.
1 2 3 4 5 6 7 8 9
TOPIC.
L1 L2 L3 L4 L5 L6 L7 L8 L9
PPT Slides
39 10 13 14 18 19 28 29 30 31 59 60 61 62 63 64 64
What is Design Pattern? Design Patterns in Smalltalk MVC Describing Design Patterns The catalog of Design Patterns Organizing the catalog How Design Patterns Solve Design Problems How to select Design Patterns How to Use a Design Pattern Review Unit-I, Online resources
UNIT-I
L1
Each pattern Describes a problem which occurs over and over again in our environment ,and then describes the core of the problem Novelists, playwrights and other writers rarely invent new stories. Often ideas are reused, such as the Tragic Hero from Hamlet or Macbeth. Designers reuse solutions also, preferably the good ones
Experience is what makes one an expert
L1
Design Patterns
Design Patterns are the best solutions for the re-occurring problems in the application programming environment. Nearly a universal standard Responsible for design pattern analysis in other areas, including GUIs. Mainly used in Object Oriented programming
UNIT-I
L1
L1
UNIT-I
L1
L1
L1
Design patterns can be subjective. One persons pattern may be another persons primitive building block. The focus of the selected design patterns are: Object and class communication Customized to solve a general design problem Solution is context specific
UNIT-I 9
L2
L2
UNIT-I
11
L2
The below diagram shows a model and three views. The model contains some data values, and the views defining a spreadsheet, histogram, and pie chart display these data in various ways. The model communicates with its values change, and the views communicate with the model to access these values. Feature of MVC is that views can be nested. Easy to maintain and enhancement.
UNIT-I 12
L2
A B C D X Y Z 15 35 35 15 10 40 30 20 10 40 30 20 A B C D D
A B C
Application data
13
L3
UNIT-I
14
L3
Pattern Name and Classification: it conveys the essence of the pattern succinctly good name is vital, because it will become part of design vocabulary. Intent: What does the design pattern do? What is its rational and intend? What particular design issue or problem does it address? Also Known As: Other well-known names for the pattern, if any. Motivation: A scenario that illustrates a design problem and how the class and object structures in the pattern solve the problem. The scenario will help understand the more abstract description of the pattern that follows.
UNIT-I 15
L3
Participants: The classes and/or objects participating in the design pattern and their responsibilities.
UNIT-I
16
L3
L3
UNIT-I
18
L4
Builder: Separates the construction of the complex object from its representation so that the same constriction process can create different representations. Chain of Responsibility: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an objects handles it.
UNIT-I 20
L4
L4
UNIT-I
21
L4
L4
L4
L4
UNIT-I
27
L4
UNIT-I
28
L5
29
L5
Behavioral Interpreter Template Method Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor
30
L6
UNIT-I
31
L6
UNIT-I
32
L6
Flyweight
Visitor
Strategy
Prototype
Template Method
Factory Method
Abstract Factory
Singleton
UNIT-I
single instance
Facade
33
L6
Type:
Denotes a particular interfaces An object may have many types Widely different object may share a type Objects of the same type need only share parts of their interfaces A subtype contains the interface of its super type
UNIT-I
34
L6
Class inheritance
parent class and subclass
UNIT-I
35
L6
L6
UNIT-I
37
L6
L6
UNIT-I
39
L6
Black-box reuse:
Reuse by object composition Requires objects to have well-defined interfaces No internal details of objects are visible
UNIT-I
40
L6
UNIT-I
41
L6
object composition
black-box reuse
Class inheritance
advantages
static, straightforward to use make the implementations being reuse more easily
UNIT-I
42
L6
implementation dependencies can cause problems when youre trying to reuse a subclass
UNIT-I
43
L6
any object can be replaced at run time Favoring object composition over class inheritance helps you keep each class encapsulated and focused on one task
UNIT-I 44
L6
Favor object composition over class inheritance Inheritance and object composition should work together
UNIT-I 45
L6
Delegation
Two objects are involved in handling a request: a receiving object delegates operations to its delegate
Window Area()
rectangle
UNIT-I
46
L6
Delegation (cont.)
Makes it easy to compose behaviors at run-time and to change the way theyre composed Disadvantage:dynamic, highly parameterized software is harder to understand than more static software Delegation is a good design choice only when it simplifies more than it complicates Delegation is an extreme example of object composition
UNIT-I 47
L6
UNIT-I
48
L6
L6
UNIT-I
50
L6
L6
L6
L6
UNIT-I
54
L6
UNIT-I
55
L6
L6
L6
L6
UNIT-I
59
L7
L7
UNIT-I
61
L8
L8
UNIT-I
63
L9
Online resources
Pattern FAQ
http://g.oswego.edu/dl/pd-FAQ/pd-FAQ.html
Basic patterns
http://exciton.cs.oberlin.edu/javaresources/Desi gnPatterns/default.htm