File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Strategy, Adapter & Facade Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Strategy, Adapter & Facade" Watch "Strategy, Adapter & Facade" New topic
Author

Strategy, Adapter & Facade

Suresh Ray
Ranch Hand

Joined: Feb 21, 2000
Posts: 55
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

Joined: Jan 18, 2002
Posts: 69
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.


MM Koppula<br />SCJP2<br />Object Oriented Analysis and Design with UML (IBM)
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
You can all find some good explanations and clarifications of the patterns at this site:
http://www.enteract.com/~bradapp/javapats.html
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Suresh Ray
Ranch Hand

Joined: Feb 21, 2000
Posts: 55
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

Joined: Jan 18, 2002
Posts: 69
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

Joined: Jul 03, 2001
Posts: 9
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

Joined: Jan 18, 2002
Posts: 69
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strategy, Adapter & Facade