Do you have a reference for that?
Not really. Its from my days at University. But the following may be
clearer than I was.
http://en.wikipedia.org/wiki/Handle_(computing)
By providing a layer of indirection it allows a system to perform some
form of resource management without having to keep to track of all
pointers to an object (as there is only one pointer, all the handles
point at this pointer). If the resource is moved you just need to
update one pointer and all handles are automatically still referencing
the correct resource.
Though handles can be opaque (thus forcing access to the data via a
functional API) this is not a requirement of handle. Most systems
force you to use an API because accessing data directly via the handle
is dangerous (as the resource could move during access). Using a
handle directly requires that it be locked before use and unlocked
after. SIDE-NOTE: Not locking a handle before use leads to very hard
to find bugs (as they can be non deterministic [especially in
multithreaded environments]). As a consequence most systems that use
handles at a high level (were there is a high proportion of developers
that are less experienced with CS techniques) now make the handle
opaque to force you to use the API so that the lock/unlock can be done
automatically. On systems were performance is an issue handles are
generally not opaque to allow the developers to optimize usage but
adds the complexity of forcing them to manually lock/unlock the
handle.
OK. That's what I remember, but as I can't provide a good source for
the definition (my CS text books are all in storage) I am quite happy
to stand corrected.