Next
/
Previous
/ Shipman's Home Sweet Homepage
/ Site map
Parts of an Icon object
For convenience, I put all the pieces of an object into a single
source file whose name is the class name. For example, a Tree
object would live in file tree.icn.
The parts of an Icon object are:
- The object itself is generally an Icon record type
containing whatever fields are necessary to hold all an object's
state. My convention is that an object of type foo is
represented by a record of type footag.
- The Icon language does not prevent the caller from accessing the
object's fields directly, but the verification panel should flag
any violations of encapsulation.
- Occasionally I'll use a simple class like an integer
or string to represent small objects, but as usual in the o-o
world, the caller should not make any assumptions about the
exact representation.
- The methods (procedures) of the object are divided into public
and private methods. Again, Icon itself does not prohibit
a client from calling a private method, but such calls are a
violation of encapsulation.
Next: Naming conventions for Icon objects
See also: Using the Cleanroom methodology with objects
Previous: An object protocol for the Icon language
Site map
John W. Shipman,
john@nmt.edu
Last updated: 1996/04/14 23:04:13
URL: http://www.nmt.edu/~shipman/soft/clean/ooparts.html