Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • You're explenation looks OK, but aren't you refering to the adapter pattern? (look at my answer). I'm not 100% sure that my example is using only the Adapter pattern, but i'm adapting the external class to implement my own interface so that it fits in my application... => adapter pattern? Facade pattern is just a wrapper around multiple objectsn to simplify certain actions: en.wikipedia.org/wiki/Facade_pattern (take a look at the computer example, where computer.Start is a simplified interface to start all of the different components) Commented Jun 25, 2013 at 7:31
  • it could be both, note he has two components to wrap, so a facade for both would be appropriate I think. The important part is you expose an interface for the wrapper Commented Jun 25, 2013 at 7:53
  • Depends, facade pattern should not be used to wrap 2 (non-interfaced) objects to expose an interface (which helps u in testing). Facade pattern with 2 objects is used to expose a simplified interface for related objects: read as: A single method call (computer.start) which will call appropriate methods of the 2 external objects (i.e. memory.start, cpu.start). This is usefull since memory and CPU should not be started seperatly. In this case, since it might be usefull to make BOTH objects mockable, you will need to create 2 adapter's instead of one facade... Commented Jun 25, 2013 at 8:05
  • If you still want a single, simplified interface for both objects, you can still use the facade pattern. But this has to happen after you have created 2 adapter's. So you'r facade should NOT use the external objects, but your own addapter implementation. The reason is: we want to avoid external classes in our application... So the first step when working with external objects is creating your own adapter! Now, you are free to do whatever you want with those adapters... Commented Jun 25, 2013 at 8:08
  • ok you've convinced me it's adapter Commented Jun 25, 2013 at 12:58