next up previous contents
Next: 4.5 Code Templates Using Up: 4 Style Guide Previous: 4.3 Instance-specific Dispatch   Contents

4.4 Organization of Source

The nature (and current limitations) of defining objects, relations, and the methods that operate over them require a certain ordering at this point which is worth mentioning. The central point of constraints is the definition of dispatching methods: these methods must have their dispatch targets available at the time they are evaluated. Since there is no late-binding yet of dispatch expressions, generally the basic construction of one's traits and prototype definitions must all occur before defining methods which dispatch to them. The definition needs merely to introduce the actual object that will be used later; other features of the objects, such as what other methods are defined upon it, are late-bound and will not hinder a method-dispatch expression.

In general, however, it is recommended to define methods in a bottom-up fashion: that more basic utilities should be introduced before the methods that use them. This allows the user (and the author) of the code to read the program sequentially as a document and have some understanding of a program's components when only the name of the component is seen. Of course, this is not always possible, but it helps often enough.


next up previous contents
Next: 4.5 Code Templates Using Up: 4 Style Guide Previous: 4.3 Instance-specific Dispatch   Contents
The Slate Project 2003-07-29