Skip to content

Commit 032ab69

Browse files
committed
Added real world example of visitor pattern.
1 parent 926814b commit 032ab69

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@
315315
* many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them
316316
* the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes
317317

318+
**Real world examples:**
319+
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
320+
318321
## <a name="model-view-presenter">Model-View-Presenter</a> [&#8593;](#list-of-design-patterns)
319322
**Intent:** Apply a "Separation of Concerns" principle in a way that allows developers to build and test user interfaces.
320323

0 commit comments

Comments
 (0)