In general, the TempMap code can be pretty frightening. What needs to be done is to define an interface to TempMap that can be easily and consistently used by map factories. There should be two general classes of functions in this interface: those for constructing the TempMap and those for working with it. Example of functions in the first category are functions to add a TempRootClassMap, TempClassMap, or TempTableMap to the TempMap -- basically a way to add or retrieve anything that is stored in a variable in TempMap. One difficulty here is that map factories have a common need to retrieve submaps that don't yet exist -- for example, when creating a TempRelatedClassMap, the map factory needs access to the TempClassMap, even though it might not yet have been constructed. Thus, the variable access functions need to come in two flavors: one to say, "I am mapping this now and an error must occur if I have already mapped it," and the other to say "I need this object and if it hasn't been created yet, please create it so I can have a reference to it." This is what is currently done with the add/map* and get* functions, although the names could certainly be better. Examples of functions in the second category are those to construct the table maps from class maps, those to construct a real Map from a TempMap, and those to construct class maps from table maps (note that the latter doesn't yet exist). Thus, the strategy followed by most map factories is either to construct the class maps (TempClassMap, TempPropertyMap, etc.) and then call a function to construct the table maps (TempTableMap, TempColumnMap, etc.) or vice versa. Both types of map factories then call a function to convert the temp maps into real maps. One final note is that similar interfaces should be defined for all the Temp* classes. For example, there should be a well-defined interface for adding columns to tables, property maps to class maps, and so on.