*** Welcome to piglix ***

Object-relational impedance mismatch


The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often encountered when a relational database management system (RDBMS) is being served by an application program (or multiple application programs) written in an object-oriented programming language or style, particularly because objects or class definitions must be mapped to database tables defined by relational schema.

The term object-relational impedance mismatch is derived from the electrical engineering term impedance matching.

Fundamentally, objects (instances) reference one another and therefore form a graph in the mathematical sense (a network including loops and cycles). Relational schemas are, in contrast, tabular and based on the relational algebra, which defines linked heterogeneous tuples (groupings of data fields into a "row" with different types for each field).

Converting linked tabular rows to graph structures is hard, and even described as the Vietnam of Computer Science.

Object-oriented programs are designed with techniques that result in encapsulated objects whose representation is hidden. In an object-oriented framework, the underlying properties of a given object are expected to be unexposed to any interface outside of the one implemented alongside the object. However, object-relational mapping necessarily exposes the underlying content of an object to interact with an interface that the object implementation cannot specify. Hence, object-relational mapping violates the encapsulation of the object.

In relational thinking, "private" versus "public" access is relative to need rather than being an absolute characteristic of the data's state, as in the object-oriented (OO) model. The relational and OO models often have conflicts over relativity versus absolutism of classifications and characteristics.


...
Wikipedia

...