Report Number: CSL-TR-88-364
Institution: Stanford University, Computer Systems Laboratory
Title: Applying object-oriented design to structured graphics
Author: Vlissides, John M.
Author: Linton, Mark A.
Date: August 1988
Abstract: Structured graphics are useful for building applications that use a direct manipulation metaphor. Object-oriented languages offer inheritance, encapsulation, and runtime binding of operations to objects. Unfortunately, standard structured graphics packages do not use an object-oriented model, and object-oriented systems do not provide general-purpose structured graphics, relying instead on low-level graphics primitives. An object-oriented approach to structured graphics can give application programmers the benefits of both paradigms. We have implemented a two-dimensional structured graphics library in C++ that presents an object-oriented model to the programmer. The graphic class defines a general graphical object from which all others are derived. The picture subclass supports hierarchical composition of graphics. Programmers can define new graphical objects either statically by subclassing or dynamically by composing instances of existing classes. We have used both this library and an earlier, non-object-oriented library to implement a MacDraw-like drawing editor. We discuss the fundamentals of the object-oriented design and its advantages based on our experiences with both libraries.