mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 20:17:21 +00:00
docs: Improve Acyclic Visitor and Adapter readmes
This commit is contained in:
1 parent
1ab8ca76fb
commit
79d41d9336
2 files changed
+10
-2
No files matched your search
@@ -160,3 +160,5 @@ Trade-offs:
|
|||||||
|
|
||||||
* [Acyclic Visitor by Robert C. Martin](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf)
|
* [Acyclic Visitor by Robert C. Martin](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf)
|
||||||
* [Acyclic Visitor in WikiWikiWeb](https://wiki.c2.com/?AcyclicVisitor)
|
* [Acyclic Visitor in WikiWikiWeb](https://wiki.c2.com/?AcyclicVisitor)
|
||||||
|
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://www.amazon.com/gp/product/0201633612/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0201633612&linkCode=as2&tag=javadesignpat-20&linkId=675d49790ce11db99d90bde47f1aeb59)
|
||||||
|
* [Head First Design Patterns: A Brain-Friendly Guide](https://www.amazon.com/gp/product/0596007124/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0596007124&linkCode=as2&tag=javadesignpat-20&linkId=6b8b6eea86021af6c8e3cd3fc382cb5b)
|
||||||
+8
-2
@@ -3,15 +3,18 @@ title: Adapter
|
|||||||
category: Structural
|
category: Structural
|
||||||
language: en
|
language: en
|
||||||
tag:
|
tag:
|
||||||
|
- Compatibility
|
||||||
- Gang of Four
|
- Gang of Four
|
||||||
|
- Integration
|
||||||
---
|
---
|
||||||
|
|
||||||
## Also known as
|
## Also known as
|
||||||
|
|
||||||
Wrapper
|
Wrapper
|
||||||
|
|
||||||
## Intent
|
## Intent
|
||||||
Convert the interface of a class into another interface the clients expect. Adapter lets classes work together that
|
|
||||||
couldn't otherwise because of incompatible interfaces.
|
The Adapter pattern converts the interface of a class into another interface that clients expect, enabling compatibility.
|
||||||
|
|
||||||
## Explanation
|
## Explanation
|
||||||
|
|
||||||
@@ -92,9 +95,11 @@ captain.row();
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Class diagram
|
## Class diagram
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Applicability
|
## Applicability
|
||||||
|
|
||||||
Use the Adapter pattern when
|
Use the Adapter pattern when
|
||||||
|
|
||||||
* You want to use an existing class, and its interface does not match the one you need
|
* You want to use an existing class, and its interface does not match the one you need
|
||||||
@@ -111,6 +116,7 @@ Use the Adapter pattern when
|
|||||||
|
|
||||||
|
|
||||||
## Consequences
|
## Consequences
|
||||||
|
|
||||||
Class and object adapters have different trade-offs. A class adapter
|
Class and object adapters have different trade-offs. A class adapter
|
||||||
|
|
||||||
* Adapts Adaptee to Target by committing to a concrete Adaptee class. As a consequence, a class adapter won’t work when we want to adapt a class and all its subclasses.
|
* Adapts Adaptee to Target by committing to a concrete Adaptee class. As a consequence, a class adapter won’t work when we want to adapt a class and all its subclasses.
|
||||||
|
|||||||
Reference in new issue
Block a user