Michael Blaha of Modelsoft Consulting Corporation has recently posted
an article on ODBMS.org titled
"Referential Integrity is Important for Databases".
In this article he lists the following benefits of defining referential integrity in a database:
- Improved data quality.
An obvious benefit is the quality of data that is stored in a database.
There can still be errors, but at least data references are genuine and intact.
- Faster development.
Referential integrity is declared. This is much more productive (one or two
orders of magnitude) than writing custom programming code.
- Fewer bugs. The declarations of referential integrity
are more concise than the equivalent programming code.
In essence, such declarations reuse the tried and tested general-purpose code in a database engine,
rather than developing the same logic on a case-by-case basis.
- Consistency across applications.
Referential integrity ensures the quality of data references across the
multiple application programs that may access a database.
We at GemStone agree that these are important issues for database systems
and were part of our decision (made over 20 years ago) to choose Smalltalk
over C++ as the language for our first database product, GemStone/S.
We examined many features of both languages and felt that Smalltalk was
superior to C++ for most of the issues our customers would have to deal
with in developing and maintaining an object database system.
Making the Smalltalk objects persistent by reachability was a natural extension
of the language and by making the programming language the same as the database
language we were able to avoid many of the impedance mismatches that occur when
two dissimilar languages must be used in the same context to solve a problem.
GemStone later introduced a Java™ version of the database product (now
called Facets) that again extends the language to include persistence
by reachability, which is based on the concept of referential integrity.
Referential integrity is, therefore, an intrinsic element of both of
GemStones OODB products:
- Every commit scans the references in modified objects to determine if
there are any new objects that need to be included in the database.
- These objects are automatically added to the transaction so
that they are atomically committed along with their references.
- Neither product implements "deleteObject" or "removeObject"
methods that could circumvent referential integrity.
- The garbage collector enforces referential integrity by only
removing objects that are no longer referenced from the database.
- Both products implement an objectAudit method that can scan the
entire database to check the referential integrity
- The typeAudit method in the Java product extends the referential
integrity to perform Java type checking on every field reference.
Other OODBMSs may support referential integrity, but in order to take
advantage of the referential integrity features the user must
explicitly define relationships or inverse members.
These relationships require additional pointers which increase the storage costs.
In contrast, the persistence by reachability in GemStones Object Database
technology is completely automatic, guarantees referential integrity,
needs no definition of inverse members and is based on single references.
Using systems like Facets and GemStone/S that support strong referential
integrity make applications easier to develop and maintain because the user
doesnt have to be concerned about the issues and exceptions that occur when
referential integrity is not enforced.
|