Originally posted by Greg Roberts:
Will this work, not giving the customer references unique names?
Yes. This is one of those small hurdles of understanding that every good programmer has to go though: an object is distinct from any "names" (variables) that refer to it. An object can have any number of "names", including zero, just as you personally might have any number of mentions in today's Washington Post. The number of times you're mentioned in the paper has no effect on you personally; you continue to exist regardless of what that number is.''
Even if an object has no "name", it can still be contained in arrays, Lists, Maps, or other data structures, so it's still quite usable. One "name" can refer to a succession of objects, and one object might gain and lose any number of "names" during its lifetime.
Now, of course, if no one
knows you exist, then you can be garbage collected