The Language of the Visitor Design Pattern

نویسنده

  • Markus Schordan
چکیده

Design patterns have been developed to cope with the vast space of possible different designs within object-oriented systems. One of those classic patterns is the Visitor Pattern that is used for representing an operation to be performed on the elements of an object structure. We present a mapping from the Visitor Pattern to a grammar that defines the set of visit sequences that can be performed by a given Visitor. The language defined by the grammar is the language of the Visitor Design Pattern. The declared purpose is the documentation of a Visitor. To allow the application of the presented approach to data structures in general, the formalism handles complications that occur when traversing arbitrary object structures, such as lack of a common base class, multiple inheritance, and inheritance from concrete classes. The mapping encodes knowledge about the class hierarchy and the implementation of the accept methods of a Visitor Design Pattern.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Using Generative Programming to Enhance Reuse in Visitor Pattern-based DSML Model Interpreters

An important part of domain-specific modeling language (DSML) tools is model interpretation – the translation of constructed models into useful artifacts, such as dense XML configuration files or source files, or other model representations. When the same DSML is used for different purposes, e.g., generating metadata for platform deployment or performance analysis, or creating composite DSMLs, ...

متن کامل

Auto-generation of Model Visitor Frameworks

The visitor pattern, a well known Gang of Four design pattern, provides a suitable way to add operational behaviour to models. However, as soon as the number of metamodels and visitor implementations start to grow, some of the pattern shortcomings make its usage less convenient. This paper presents how the synergy between the Visitor pattern and MDE has been addressed by two open source project...

متن کامل

Functional Visitors Revisited

In object-oriented programming the visitor design pattern allows for the addition of new operations on a data hierarchy, but lends itself to scattered traversal code and makes visitors difficult to combine. Previous attempts to solve these issues have separated traversal code from the data structure but still face a lack of modularity in visitor computation making it difficult– if not impossibl...

متن کامل

From Patterns to Components: The Visitor Library

To what extent can design patterns be turned into reusable, off-the-shelf components, taking advantage of advanced language features? We reviewed the patterns described in the book Design Patterns by Gamma et al. [5], and established a new classification of these patterns by level of “componentizability” (possibility to transform a design pattern into a reusable component) [1]. This article rep...

متن کامل

The Debuggable Interpreter Design Pattern

The use of Interpreter and Visitor design patterns has been widely adopted to implement programming language interpreters due to their expressive and simple design. However, no general approach to conceive a debugger is commonly adopted. This paper presents the debuggable interpreter design pattern as a general approach to extend a language interpreter with debugging facilities such as step-ove...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • J. UCS

دوره 12  شماره 

صفحات  -

تاریخ انتشار 2006