Skip to content

Commit 5fc5888

Browse files
committed
Update markup; add link to wiki adapter page
1 parent 8a51097 commit 5fc5888

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

chapters/design_patterns/adapter.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
---
2-
layout: default
3-
title: Adapter pattern
4-
---
5-
6-
## Sample recipe template
7-
8-
Create a new `my-recipe.md` file and use this text as a start.
9-
10-
{% highlight text %}
11-
---
122
layout: recipe
133
title: Adapter patter
144
chapter: Design patterns
@@ -17,9 +7,10 @@ chapter: Design patterns
177

188
Suppose we have 3-rd party grid component. We want to apply there our own custom sorting but a small problem. Our custom sorter does not implement required interface by grid component.
199
To understand the problem completely best example would be an socket from our usual life. Everybody knows this device. In some countries it has 3 pins and in other contries it has only 2 pins.
20-
This is exactly right situation to use adapter.
10+
This is exactly right situation to use [adapter pattern](https://en.wikipedia.org/wiki/Adapter_pattern).
2111

2212
## Solution
13+
2314
{% highlight coffeescript %}
2415
# a fragment of 3-rd party grid component
2516
class AwesomeGrid
@@ -58,5 +49,3 @@ agrid.sort() # sort data with custom sorter through adapter
5849

5950
Adapter is usefull when you have to organize an interaction between two objects with different interfaces. It can happen when you use 3-rd party libraries or you work with legacy code.
6051
In any case be carefull with adapter: it can be helpfull but it can instigate design errors.
61-
62-
{% endhighlight %}

0 commit comments

Comments
 (0)