1 / 5

VOP Exam June 13. 2006

VOP Exam June 13. 2006. Group 6: Jones Olaiya Ogunduyilemi Knut Tveitane. 3. Visitor Pattern. Used to traverse an object hierarchy, adding functionality to each class of objects (”Elements”) Implemented using Double Dispatch

Download Presentation

VOP Exam June 13. 2006

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VOP Exam June 13. 2006 Group 6: Jones Olaiya OgunduyilemiKnut Tveitane

  2. 3. Visitor Pattern • Used to traverse an object hierarchy, adding functionality to each class of objects (”Elements”) • Implemented using Double Dispatch • Elelment classes implement accept(IVisitor v) method which call v.visit(this) • Traversal of lower levels can be handled from the client or from within the visitor class methods • Example: Different ”print” functionality for the object tree in UML Diagram Editor

  3. 4. Double Dispatch • Used to achieve ”2-level polymorphy” • Level 1: Client’s choice of functional extension class (”Visitor” in Visitor Pattern) • Level 2: Class of the Element to process • One class per functional extension type • Extension classes implement common interface • Each extension class implement one extension method per Element class to process • Example: Used with Visitor Pattern

  4. 8. Interaction-based Testing • Tests interactions between objects • ”White Box” – assumes knowledge of inner workings • Primary object – object to perform test on • Mock objects – proxy objects/stubs for objects the primary object interacts with • Interface based: ”Real” and mock objects must implement the same interface or abstract class • Calls to mock objects (methods and arguments) are examined (using reflection) and compared to expectations • NMock can create and test mock objects

  5. 15. Adaptive Object Model • No domain specific classes • Classes define metadata attributes • Property pattern: Object attributes as a collection of property objects • Property class defines name,type and value attributes • Adapts easily to new object types • Custom tools -> user configurable solution • Including object relations and business logic • Tools are domain specific, not the data model

More Related