NamingSystem |
UserPreferences |
The PEAK Developers' Center | FrontPage | RecentChanges | TitleIndex | WordIndex | SiteNavigation | HelpContents |
What's a naming system, and why do you want want for your programs? Naming systems let us use names instead of addresses to refer to the objects we use. Whether the objects in question are database connections, printers, documents, or distributed object services, replacing addresses with names makes programs clearer, more flexible, and easier to maintain.
What's the difference between a name and an address, and why is it important? A name tells us what something is, or is for, while an address tells us how to get to it. This is significant because "how to get to" something can change far more quickly than what it "is".
Let's say we are in a grocery store. I could either say, "go to the back of the store, aisle 4, top shelf, right-hand side, fifth can," or I could simply say, "I'd like a can of spam please." Obviously, if the store is later reorganized, my "address" for spam may have to be changed, but as long as it's still called spam, I can always ask a clerk or look at a store directory.
Of course, this means that I must go through an intermediary to obtain my spam, rather than going directly to it, but that is the price I pay for the flexibility.
Notice this also means that names are context-sensitive. That is, the interpretation of a name can vary according to the context. Asking my grocer or my e-mail client for "spam" will produce very different results. But an address is context-independent, and will always refer to the same location, although what is in that location might change over time.
Names | Addresses |
What an object is or does | How to find it |
Long-lasting | Transient, may change for a given object |
Must be resolved via a naming service | Allows direct access |
Context-sensitive | Context-independent |
XXX blah blah ...