An overview of object-oriented programming techniques used for storing, managing and sharing objects in a computer system
Thursday, August 7, 2008 at 1:01PM
Steve Holcombe
The following quoted text (beginning at the bullet) is taken from the statement of prior art in
US Patent 5,682,532 entitled
System and method having programmable containers with functionality for managing objects and filed in 1994 by Microsoft Corporation.
- "Permanent storage devices of conventional computer systems are arranged
in a hierarchical fashion. This hierarchy is formed through the use of
directories or folders. A folder is a logical grouping of files and
other folders. When a user
wishes to store information on the permanent storage device of a
computer system, the user creates a folder and moves, copies, or
creates files in the folder. The functionality associated with a folder
is typically defined by a computer system. This
functionality may include simply adding and deleting files of a folder.
Thus, in conventional computer systems, the user has little control
over the functionality of the folder. For example, a user cannot
typically restrict the types of files that are
stored in a folder nor can a user modify a folder so that all users
must observe a checkin-checkout protocol when accessing the files in
the folder.
The present invention is described below using some
object-oriented techniques; thus, an overview of well-known
object-oriented programming techniques is provided. Two common
characteristics of object-oriented programming languages are support
for data encapsulation and data type inheritance. Data encapsulation
refers to the binding of functions and data. Inheritance refers to the
ability to declare a data type in terms of other data types. In the C++
language, data encapsulation and
inheritance are supported through the use of classes. A class is a
user-defined type. A class declaration describes the data members and
function members of the class. A function member is also referred to as
a method of a class. The data members and
function members of a class are bound together in that the function
operates on an instance of the class. An instance of a class is also
called an object of the class. Thus, a class provides a definition for
a group of objects with similar properties
and common behavior.
To allocate storage for an object of a particular type
(class), an object is instantiated. Once instantiated, data can be
assigned to the data members of the particular object. Also, once
instantiated, the function members of the particular
object can be invoked to access and manipulate the data members. Thus,
in this manner, the function members implement the behavior of the
object, and the object provides a structure for encapsulating data and
behavior into a single entity.
To support the concept of inheritance, classes may be derived
from (based upon the declaration of) other classes. A derived class is
a class that inherits the characteristics--data members and function
members--of its base classes. A class that
inherits the characteristics of another class is a derived class. A
class that does not inherit the characteristics of another class is a
primary (root) class. A class whose characteristics are inherited by
another class is a base class. A derived
class may inherit the characteristics of several classes; that is, a
derived class may have several base classes. This is referred to as
multiple inheritance.
A class may also specify whether its function members are
virtual. Declaring that a function member is virtual means that the
function can be overridden by a function of the same name and type in a
derived class. If a virtual function is
declared without providing an implementation, then it is referred to as
a pure virtual function. A pure virtual function is a virtual function
declared with the pure specifier, "=0". If a class specifies a pure
virtual function, then any derived class
needs to specify an implementation for that function member before that
function member may be invoked. A class which contains at least one
pure virtual function member is an abstract class.
[Original image modified for size and/or readability]FIG. 1 is a block diagram illustrating typical data structures
used to represent an object. An object is composed of instance data
(data members) and function members, which implement the behavior of
the object. The data structures used to
represent an object comprise instance data structure 101, virtual
function table 102, and the function members 103, 104, 105. The
instance data structure 101 contains a pointer to the virtual function
table 102 and contains data members. The virtual
function table 102 contains an entry for each virtual function member
defined for the object. Each entry contains a reference to the code
that implements the corresponding function member. The layout of this
sample object conforms to models defined in
U.S. Pat. No. 5,297,284, entitled "A Method for Implementing Virtual
Functions and Virtual Bases in a Compiler for an Object Oriented
Programming Language," which is hereby incorporated by reference. In
the following, an object will be described as an
instance of a class as defined by the C++ programming language. One
skilled in the art would appreciate that other object models can be
defined using other programming languages.
An advantage of using object-oriented techniques is that these
techniques can be used to facilitate the sharing of objects. For
example, a program implementing the function members of an instantiated
object (a "server program") can share the
object with another program (a "client program"). To allow an object of
an arbitrary class to be shared with a client program, interfaces are
defined through which an object can be accessed without the need for
the client program to have access to the
class definitions at compile time. An interface is a named set of
logically related function members ("methods) and data members
("properties"). In C++, an interface is an abstract class with no data
members and whose virtual functions are all pure. Thus, an interface
provides a published protocol for two programs to communicate.
Interfaces are typically used for derivation: a program defines
(implements) classes that provide implementations for the interfaces
the classes are derived from. Thereafter, objects are created as
instances of these derived classes. Objects instantiated from a derived
class implementing particular interfaces are said to "support" the
interfaces. An object supports one or more interfaces depending upon
the
desired functionality.
When a client program desires to share an object, the client
program needs access to the code that implements the interfaces for the
object (the derived class code). To access the derived class code (also
referred to as class code), each class
implementation is given a unique class identifier (a "CLSID"). For
example, code implementing a spreadsheet object developed by Microsoft
Corporation may have a class identifier of "MSSpreadsheet," while code
implementing a spreadsheet object developed
by another corporation may have a class identifier of "LTSSpreadsheet."
A persistent registry in each computer system is maintained that maps
each CLSID to the code that implements the class. Typically, when a
spreadsheet program is installed on a
computer system, the persistent registry is updated to reflect the
availability of that class of spreadsheet objects. So long as a
spreadsheet developer implements each function member defined by the
interfaces to be supported by spreadsheet objects and
so long as the persistent registry is maintained, the client program
can access the function members of shared spreadsheet objects without
regard to which server program has implemented them or how they have
been implemented.
Since an object may support some interfaces and not others, a
client program would need to determine at runtime whether a particular
object supports a particular interface. To enable this determination,
every object supports the interface
IUnknown, which contains a function member, QueryInterface, that
indicates which interfaces are implemented for the object. The method
QueryInterface is defined as follows:
The method QueryInterface is passed an interface identifier in
parameter iid (of type REFIID) and returns in parameter ppv a pointer
to the implementation of the identified interface of the object for
which the method is invoked. If the object
does not support the interface, then the method returns a false. The
type HRESULT indicates a predefined status.
[Original image modified for size and/or readability]FIG. 2 is a symbolic representation of an object. In the
following description, an object data structure is represented by the
shape 201 labeled with the interfaces through which the object may be
accessed .....
In accordance with a first aspect of the present invention, a
method is executed in a distributed system having a Dumber (sic) of computer
systems that are connected by a network. In accordance with this method
of the first aspect of the present
invention, at least one of the computers has a container for storing
objects and links. This method provides for the programmability of the
container. The programmability of the container is provided through
replacing the methods of the container and
extending the functionality of the container.
In accordance with a second aspect of the present invention,
an improved storage mechanism is provided. The storage mechanism of the
preferred embodiment provides for a programmable container. The
container of the preferred embodiment contains
methods that are replaceable as well as a command unit that extends the
functionality of the container .....
A preferred embodiment of the present invention provides for an
improved method and system for storing information in a computer
system. In a preferred embodiment, information is stored through the
use of a container. A container is an object
that contains a collection of data ("contained objects") and that
provides an interface through which to access the collection of data.
The contained objects can include files, databases, electronic mail
messages, bitmaps, other objects, other
containers, and various other types of data. In the preferred
embodiment, a container is programmable. This programmability is
provided by allowing for replacement of the implementation of the
interface of the container ("replaceability") and by
allowing for the extension of the functionality provided by the
interface ("extendibility"). Because containers are replaceable and
extendible, the functionality of a container can be tailored to the
needs of a user. For example, a user can extend the
functionality of a container to limit the types of data that are stored
within the container. Thus, containers are a more flexible storage
mechanism than conventional folders."
I am filing this entry in the Reference Library to this blog.
Article originally appeared on The @WholeChainCom Blog (http://www.pardalis.com/).
See website for complete article licensing information.