File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Design Patterns Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Design Patterns Question " Watch "Design Patterns Question " New topic
Author

Design Patterns Question

Sayali Mahindrakar
Greenhorn

Joined: Feb 06, 2001
Posts: 1
(1)Which one of the following is a key difference between the Adapter
and Facade Structural Design Patterns?
a)The Adapter defines a new Interface; the Facade reuses an existing one.
b)Facade is an extension of the Adapter.
c)The Adapter defines a new Interface; the Facade combines two existing Interfaces.
d)The Facade defines a new Interface; the Adapter reuses an existing one.
e)The Facade defines a new Interface; the Adapter combines two existing Interfaces
I think d is correct. An adapter does not define a new interface. What do you all think
Vladan Radovanovic
Ranch Hand

Joined: Mar 20, 2000
Posts: 216
Hi,
Adapter converts the interface of a class into another interface client expects while
Facade provides unified (higher level) interface to a set of interfaces in a subsistem.
so the answer is I guess d.
[This message has been edited by Vladan Radovanovic (edited February 22, 2001).]
Tony Chen
Ranch Hand

Joined: Jan 29, 2001
Posts: 286
Originally posted by Sayali Mahindrakar:
d)The Facade defines a new Interface; the Adapter reuses an existing one.

I agree with you guys.
According to GoF, the Intent of Adaptor is: Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. A class adapter uses multiple inheritance to adapt one interface to another; an object adapter relies on object composition.

SCJP Java 2 - IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0 - IBM Certified System Administrator - WebSphere Network Deployment V6.0 - Canadian Securities Course (CSC) Certification
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
Originally posted by Sayali Mahindrakar:
(1)Which one of the following is a key difference between the Adapter and Facade Structural Design Patterns?
a)The Adapter defines a new Interface; the Facade reuses an existing one.
b)Facade is an extension of the Adapter.
c)The Adapter defines a new Interface; the Facade combines two existing Interfaces.
d)The Facade defines a new Interface; the Adapter reuses an existing one.
e)The Facade defines a new Interface; the Adapter combines two existing Interfaces

Adapter Pattern - When you have to implement an interface, but you want to use another class (or interface's) methods in order to implement it you are using the Adapter Pattern.
Facade Pattern - Facade is a high level interface that masks lower-level subsystems. In EJB distributed object architecture, sessions beans can be used to provide a high-level interface to a facade to business processes, masking the lower-level entity bean subsystems used behind the scenes.
So d is correct.


SCJP 1.5, SCEA, ICED (287,484,486)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Design Patterns Question