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*
- 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)Frederik P.– Frederik P.2013-06-25 07:31:55 +00:00Commented 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 wrapperjk.– jk.2013-06-25 07:53:05 +00:00Commented 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...Frederik P.– Frederik P.2013-06-25 08:05:29 +00:00Commented 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...Frederik P.– Frederik P.2013-06-25 08:08:17 +00:00Commented Jun 25, 2013 at 8:08
- ok you've convinced me it's adapterjk.– jk.2013-06-25 12:58:34 +00:00Commented Jun 25, 2013 at 12:58
| Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cs