Font Size:
Approaches to implementing a traversal operation on an object structure: a comparison
Last modified: 2015-08-08
Abstract
In the paper we present several approaches of a traversal operation implementation on an object structure. Such operations and structures are often used in engineering software, e.g., in compiler design, code analytics, plagiarism-detection tools, etc. We focus on the following approaches (and their variants): dedicated methods, type checking and casting, visitor design pattern, and reflection based approach. The main goal of this paper is to explore and compare those approaches on a clear working example. Additionally, we describe several variants of reflection-based approach rather than the most straightforward one usually implemented. The presented approaches vary in many properties such as programming skills involved, separation of operation from the structure, performance, extensibility etc. Our detailed presentation enables an effective comparison based on such criteria which present the technical and practical aspects of each approach. In this way programming practitioners gain a complete insight into pros and cons of different traversal implementations.
Full Text:
PDF