Name Patterns in Limpid

Background

The influence of Java on the W3C DOM is very clear in the patterns for names of nodes and their methods (functions). It is possible to deviate from standard practice (spelling intended) in Java, but normal use is along the following lines:

This has the nice side effect that an instance of a class can have a clear relationship to the class itself, eg nodeList as an instance of NodeList. Furthermore, if this discipline is followed, there is no problem remembering whether or not you have decided to name a class myClass or MyClass, or whether an instance is myInstance or MyInstance or whether one of its functions is getFirst() or GetFirst().

The JavaBean get/set concept and name pattern is in evidence. For Node, examples are getNodeType(), getChildNodes(), getFirstChild(), etc. These methods (functions) are part of the W3C DOM recommendation, and are adopted fully in Limpid. Set methods, such as setNodeType(), are much less common, because of the requirements of the DOM, but one example is NamedNodeMap::setNamedItem().

There is the occasional inconsistency in the recommendation, too. Examples are NodeList::item() and NameNodeMap::item(), where getItem() might have been expected. DocumentType is sometimes referred to as doctype (Java programmers will recall HashMap, but Hashtable); more serious is Element::getAttribute(...), while the class is Attr!

A specialisation of the get/set pattern relates to boolean values. When the getXXX() method returns a boolean, the name might be isXXX() or hasXXX(). Examples are Node::hasChildNodes() and Element::hasAttribute().

A final pattern that has not yet been fully implemented throughout Limpid is:

Name Patterns in Limpid Classes

These follow the same form as in Java. The main groups are:

All of these classes have self-describing names and interfaces and, in combination, provide much of the power of Limpid.