Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The visitor design pattern

2,701 views

Published on

Published in: Education
  • I have done a couple of papers through ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐ they have always been great! They are always in touch with you to let you know the status of paper and always meet the deadline!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I can advise you this service - ⇒ www.HelpWriting.net ⇐ Bought essay here. No problem.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

The visitor design pattern

  1. 1. The Visitor Design Pattern<br />SamnangChhun<br />Yoolk Inc.<br />
  2. 2. Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.<br />What this?<br />Open Closed Principle is the key<br />The Visitor Design Pattern<br />
  3. 3. Structure<br />
  4. 4. Example<br />
  5. 5. Consequences<br />Benefits<br />Adding new operations is easy<br />Related behavior isn’t spread over the classes defining the object structure; it’s localized in a visitor. Unrelated sets of behavior are partitioned in own visitor subclasses.<br />Liabilities<br />Adding new ConcreteElement class is hard. Each new ConcreteElement give rise to a new abstract operation on Visitor and a corresponding implementation in every ConcreteVisitor class.<br />The ConcreteElement interface must be powerful enough to let visitors do their job. You may be forced to provide public operations that access an element’s internal state, which may compromise its encapsulation.<br />
  6. 6. Don’t forget to review all of them again and again<br />
  7. 7. Thank you!<br />

×