README in Visitor

This commit is contained in:
Dominik Liebler
2013-09-24 13:01:41 +02:00
parent fe6127044e
commit ea3e477a74
2 changed files with 9 additions and 8 deletions

8
Visitor/README.md Normal file
View File

@@ -0,0 +1,8 @@
# Visitor
## Purpose
The Visitor Pattern lets you outsource operations on objects to other objects. The main reason to do this is to keep a separation of concerns.
But classes have to define a contract to allow visitors (the `Role::accept` method in the example).
The contract is an abstract class but you can have also a clean interface. In that case, each Visitor has to choose itself which method to invoke on the visitor.

View File

@@ -3,14 +3,7 @@
namespace DesignPatterns\Visitor;
/**
* Visitor Pattern
*
* Purpose:
* The Visitor Pattern lets you outsource operations on objects to other objects. The main reason to do this is to keep
* a separation of concerns. But classes have to define an contract to allow visitors (the "accept" method in the example below).
*
* The contract is an abstract class but you can have also a clean interface.
* In that case, each Visitor has to choose itself which method to invoke on the visitor.
* class Role
*/
abstract class Role
{