• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Design Patterns Question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(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
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic