Structural Design Pattern
Structural Design Pattern
CSS Session 13
1
Agenda
What are Structural Design Patterns
and how we can make use of them?
Situation 1
Situation 2
Situation 3
Situation 1
I have Developer which knows how
to code and Tester who knows how to
test the code.
Now, we want our developer to be a
tester, which means tester methods
would be called on our developer
object.
So, client must not feel difference,
whether he is calling tester or
developer object.
Situation 1
Situation 2
I have Perforce Server, and I want to
download the code of XYZ Branch. I have
one constructor to initialize the project
which I want to download and one method
to display the code.
Problem is , now whenever , call this API, it
would start downloading the code. We want
that code should be downloaded every
time, it should check if disk already have
that code, dont download.
Second is , we want to block our API access
to Testing team
9
Situation 2
10
12
Situation 3
Suppose , we have to place C1 Order
which takes us , few parameter from
us
Void createOrder(ActionCode code,
int orderNumber);
ActionCode is class having code as
parameter, to tell C1, which order do
we want to create.
13
14
15
References
http://
en.wikipedia.org/wiki/Structural_patt
ern
http://
en.wikipedia.org/wiki/Adapter_patter
n
http://
en.wikipedia.org/wiki/Flyweight_patte
rn
16
Thank you
17