This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strategy, Adapter & Facade

 
Suresh Ray
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody provide a comparison between the above patterns ?
Strategy is a kind of Adapter and an strategy object is also a Facade object, since it provides a level of indirection to the underlying interfaces / classes.
On what basis, one can distinguish by looking at a class, whether it is a Adapter or a Strategy class (other than the naming style of the class)? Because, I feel there is a lot of overlapping and the distinction between these classes are kind of blur..( atleast to me )
Please share your thoughts..
Thanks.
 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strategy is a kind of Adapter and an strategy object is also a Facade object, since it provides a level of indirection to the underlying interfaces / classes.
Adapter is a structural pattern. Adapter uses indirection to modify the interface of a class. In this, the adapter 'uses' the 'oldClass'. And the client class 'uses' the adapter.
Strategy is a behavioral pattern. In this you will see a super-sub type relationship. The sub-types implement the strategy laid out by the super class. In this, the interface of one class is not modified by the other. It is a generalization relationship. The client 'uses' the supertype.
The question whether the structure (interface) of a class is modified by the pattern? will tell you if the pattern is an adapter patten or not. Generalization relation is by which you can identify the strategy pattern (also in case of template pattern. Both Template and Strategy are same except in their intent of use).
That is what my understanding is. Any corrections are welcome.
I do not know about Facade pattern. I will be glad if you can explain it.
Thanks.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can all find some good explanations and clarifications of the patterns at this site:
http://www.enteract.com/~bradapp/javapats.html
Kyle
 
Suresh Ray
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle for the link.
Merlin, thanks for your inputs.
I do not know about Facade pattern. I will be glad if you can explain it.

As per my understanding, a Facade object provides a single unified interface and is responsible for collaborating with other(subsystem) objects. Basically, it provides a single point of contact for the subsystem (wrapping the subsystem).
The advantage of this pattern, is that a client needs to interact only with one unified interface for all the subsystem services.
Hope it helps.
Also, I am planning to take the IBM certification exam (486), soon. I have prepared for about 3 weeks now and have mainly relied on Larman's book for majority of the concepts. Also, have been referring UML Distilled and other Design patterns/UML related books. Have also taken the ICE test, scoring 94% and also the brainbench test.
Can anyone please share their preparation tips for the 486 exam?
Thanks.
 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh,
I took the brain bench test too. Eventhough I passed the test, I had a poor score. I think the brainbench test is more notation oriented and I found it more difficult than the ICE test. Do you know if the actual test is more in line with ICE test or the brainbench test?
I have been preparing OOAD for last couple of months. In fact I can say I wasted a lot of weeks not knowing the right resources, before I started looking into JavaRanch. Eventhough I learnt some stuff, from exam point of view, I wasted a lot of time by reading OOAD by Booch (However, there are some good applications at the end of the book).
I read thru UML distilled a couple of times. But I completed Larman only half. (you see, I am not a fast reader). I am planing to read it thru 2nd Eloboration before I take the test. Do you know of anyone who passed the test without completing Larman?
It would help if others share their preparation experience too.
Thanks.
 
David Meyers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What/where is the brainbench test? Anyway, I've heard of people passing without Larman. I'm currently reading Larman, but haven't got to anything that wasn't included in UML Distilled.
thanks
 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
Herre is the URL that I saved for the test:
http://www.brainbench.com/xml/bb/common/testcenter/freetests.xml#
You need to register and get an id for the test.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic