Professional Documents
Culture Documents
Lecture # 10
Lecture # 10
Design Pattern
Lecture : 11
2
i. DVD Player
ii.Sound Systems
iii.Amplifiers
iv.Projector
v.Screen
vi.CD Player
vii.Theatre Lights etc
Façade will not add any extra functionality it will just simply
the access to functionality.
i. An Object itself
ii.Object passed in as a parameter
iii.Any method that object creates or instantiates.
iv.Any component of the Object
18
Example
For an typical online transaction oriented system,
customer can perform transactions against an account i-e
Pay pal etc; credit card validators are used for verifying the
creditionals of a client submitted by the client for checkout
purposes. Address of the customer is also stored and
checked for data entry checks for shipment purposes.
Usually account, address and credit card subsystems works
together to provide the feature of online transaction.
24
To Do Tasks:
Build an application which perform the
following tasks
Advantages of Facade
It shields the client from subsystem components, thereby
reducing the number of objects that clients have to deal with.
Design Pattern
Lecture : 12
30
i. Individual Components
ii.Composite Components — which are composed of
individual components or other composite
components
32
Aggregation
In an aggregation relationship, the child class
instance can outlive its parent class.
Example
37
Aggregation Example
38
uniform manner
40
Design Approach
Let us define a common interface for both directories
and files in the form of a Java interface
FileSystemComponent The FileSystemComponent
interface declares methods that are common for both file
components and directory components. Let us further
define two classes — FileComponent and DirComponent
— as implementers of the common
FileSystemComponent interface as shown in next slide
44
Description of Classes
FileComponent
The FileComponent class represents a file in the file
system and offers implementation for the following
methods.
getComponentSize()
Class Descriptions
DirComponent
Class Description
addComponent(FileSystemComponent)
This method is used by client applications to add different
DirComponent and FileComponent objects to a
DirComponent object.
getComponent(int)
Class Description
getComponentSize()