Design Issue - Object Keys
A key is an object attribute whose value uniquely identifies a
single target object. (Booch - Object Oriented Analysis and Design)
The designer must find the appropriate key attribute for every class.
As Booch says, an object has state, behavior and identification.
The user interface designer must
identify, from the user domain, the correct key for every use case
requiring object identification. Don't confuse these two design problems!
The rules are easy for the UI designer:
- Look up the key in the data dictionary.
- Ask the systems analyst or user.
- Don't violate any state or federal laws (e.g. use of SSN in some domains).
- UI keys don't need to be unique.
- Never, under any circumstance, invent a key.
Finding the correct unique attribute for each class:
- Often the user domain key works.
- An object's address might serve the purpose (beware of memory leaks).
- Perhaps a combination of attributes?
- Perhaps an attribute and address?
- Invent a key only as a last resort and never show it in the UI.
Last updated on 10/29/98