VBD Applications

Topics
Persistent Objects
Database Models
Variable Block Database Applications

## Persistent Objects

A persistent object is an object that saves its state between program invocations. Normally an object's data, stored in memory, is lost when the program terminates. Persistent objects store their data both in memory and in a disk file. When the program is terminated and restarted again, the persistent object can restore its last state by loading its data from the disk file. This is the basis of an objected-oriented database.

## Database Models

OBJECT-ORIENTED DATABASE

:
An object-oriented database is based on persistent objects and extends the object-oriented programming principles of abstraction, encapsulation, inheritance, and polymorphism into the database. A persistent object is able to represent any kind of data because there is no restrictions on its format and content. This allows an object-oriented database to define complex data items, arrays, variable lists, and user-defined data types within its records definition.

RELATIONAL DATABASE

:
A relational database consists of fixed-length, fixed-format records, which form tables of rows and columns. Each record has a primary key data element to uniquely identify the record in the database. In a relational database the relationship between the rows and columns is represented by data values rather than record addresses.

RELATIONAL DATABASE vs OBJECT-ORIENTED

:
Both the relational and object-oriented database models have their advantages. An object-oriented database is not bound by rows and columns and can be made to represent any type of data. A relational database can easily provide a general-purpose query and report writer languages to find, sort, view, and print the records in the database.

## Variable Database Base Applications

The VBD file format is very flexible, allowing it to support the object-oriented database model and an object-oriented database with some relational properties. Several example programs are provided with this distribution that implements these concepts. The examples demonstrate how to create both simple and complex database applications using the VBD C++ class library.

The VBD file manager is the base for each application. It is responsible for all low-level file operations such as: Create(), Open(), Read(), Write(), Alloc(), Delete(), and Close(). An abstract base class is used to define the interface that makes an object persistent. Pure virtual functions are used to define the persistent object interface. Persistent objects are created by inheriting the persistent base class and defining methods for reading and writing user-defined types, built-in types, pointers, and references within an object of the derived class.

Relational properties come from the use of index files. An index file is used to store the location of objects in a data file. Data files are VBD files used to store an object's data to disk. Index files are comprised of fixed length keys organized in a disk based B-tree. Every key in the index file is associated with an object in the data file. All find, sort, view, and print operations are performed using the B-tree algorithm.

The Persistent Object Database manager is used to manage file pointers to the program's data file and index file. When a POD object is instantiated it automatically creates a data file and an index file, or opens an existing set of files. The VBD file manager creates both the data and the index file. The data file is maintained by the persistent base class and the B-tree class maintains the index file.

End Of Document