next up previous contents
Next: Performing Actions Up: Naming Methods Previous: Queries   Contents

Creating

While the method clone is the core of building new objects in Slate, rather than instantiating a class, there is still the need to provide and use an idiom for delivering optional attributes and varying semantics of creation to one's new objects. Generally, these methods should start with new- as a prefix to help the reader and code user to know that the original object will not be modified, and that the result is a new, separate individual. These methods are usually methods with keywords, with each of the keywords describing each option. If the keyword literally names an attribute, the optional-keyword facility is ideal, but if providing a grammatical phrase using prepositions, it is preferable to create a full keyword method.



Brian Rice 2004-08-24