Tools.h++ Manual

1-4 104011 Tandem Computers Incorporated
1
the class
Object
used by Smalltalk and The NIH Classes). Instead, only objects
that are to be collected using the Smalltalk-like collection classes need inherit a
base class
RWCollectable
. The advantage of this is that virtual base classes
are not necessary, simplifying the inheritance tree and the difficult problem of
casting from a base class back to its derived class.
Simplicity. There is a temptation to keep adding subclasses to add power or
convenience for the user or to demonstrate one's prowess with the language.
We have avoided this. Although the overall architecture is sophisticated and
integrated, each class usually plays just one well-defined, pivotal role. Most
functions are extraordinarily simple: a few lines of code.
Compactness. An important goal was to make sure that programs compiled
small. This was to insure that they can be used in embedded systems.
Predictability. Many new users of C++ become so giddy with the power of
being able to overload esoteric operators like "&=" that they forget about tried-
and-true function calls and start redefining everything in sight. Again, we
have avoided this and have tried hard to make all of the familiar operators
work just as you might expect—there are no surprises. This approach gives
great symmetry to the class library, making it possible to do such things as, say,
change the implementation of a
Dictionary
from a hash table to a
B-Tree
with impunity.
In general, whenever we considered a new feature, we tried to think as
Stroustrup would: if there was already a way to do it, we left it out!
1.4 Conventions
All class names start with the letters "RW". All function names start with a
lower case letter, but subsequent words are capitalized. There are no underline
characters used in names. An example of a class name is
RWHashDictionary
,
of a function
compareTo()
. Generally, abbreviations are not used in function
names, making them easy to remember.
Some of the class names may seem unnecessarily tedious (for example, a
singly-linked list of collectables, accessible as a stack, is a
RWSlistCollectablesStack
). There are two reasons for this. First, using
generic names like "Stack" invites a name collision with someone else's stack
class, should you write a large program that combines many class libraries. We
have tried very hard to avoid polluting the global name space with generic