/ Shipman's Home Sweet Homepage
/ Site map
An object protocol for the Icon language
This page describes how I do object-oriented programming in the
Icon language. My
example programs use some, but not
all, of the classic object-oriented techniques.
- Each object is an abstract data type consisting of a bundle
of state and an accompanying set of methods
(procedures) that are the only permissible route for changing
the state of the object.
- I've used some polymorphism, but haven't needed it much.
- I don't use a lot of inheritance, preferring delegation
as described in Erich Gamma's Design Patterns. For
example, if an object can be structured into trees, the classic
approach is to invent a Tree class and then customize it. Instead,
I wrote a
generic tree class,
and if an object has ``tree-ness,'' it points to the related
tree-node object, and delegates such operation as ``find parent''
or ``enumerate children'' to that object.
Continue to the parts topic for a
description of the actual Icon conventions.
Next: Parts of an Icon object
See also: Using the Cleanroom methodology with objects
John W. Shipman,
Last updated: 2002/09/28 21:39:18