JavaScript Visitor Design Pattern

Costas

Administrator
Staff member
The Visitor pattern defines a new operation or a set of operations on an object or a set of objects without changing the objects themselves. The new logic is implemented in a separate object defined as visitor. That is useful when building extensibility in a library or a framework. If objects provide a visit method accepting the visitor object making alterations to the current one, then there is a flawless way for clients to implement future extensions.

The Visitor pattern is less important in JavaScript as it offers the ability to add and remove methods at runtime but it is still useful to have that pattern in mind.

http://www.shieldui.com/blogs/javascript-visitor-design-pattern
 
Top