Recent Articles



































Impedance mismatch



         


Impedance mismatch has two meanings.

It is a problem in electrical engineering that occurs when two transmission lines or circuits with different impedances are connected. This can cause signal reflection resulting in attenuation and noise. See also impedance matching.

In programming terminology it refers to the attempt to connect two systems that have very different conceptual bases, most commonly when trying to use a SQL database from an object oriented program. Christopher J. Date would argue that a truly relational DBMS would pose no such problem, as domains and classes are essentially one and the same thing. Another significant impedance mismatch in programming occurs between the domain objects and the user interface.

[Top]

Impedance mismatch between object-orientation and relational databases

The impedance mismatch between object-oriented programming and relational databases occurs when a relational database is being used within an object-oriented program in such way that objects are mapped in straightforward way to database tables. This practice has been recommended and documented by some object-oriented literature as a way to use databases in object-oriented programs. However, object-oriented programs are designed with methods that result in encapsulated objects whose representation is hidden. Mapping such private object representation to database tables makes such databases fragile, since there are significantly less constraints for design of encapsulated private representation of objects compared to database's use of public data, which must be amenable to upgrade, inspection and queries.

In particular, object-oriented modelling emphasises the essential concept of an invariant, which requires the use of encapsulation before any access to data of OOP objects is performed. These invariants cannot be represented in relational databases. In relational thinking, "private" versus "public" is relative to need rather than an absolute characteristic of a piece of state (data). Relational and OO often have conflicts over relativity versus absolutism of classifications and characteristics. It is sometimes said that OO is a Plato-like view of the world while relational is an Einstein-like view.

Also, access to objects in object-oriented programs is allegedly best performed via interfaces that together provide the only access to the internals of an object. Similarly, essential OOP concepts for classes of objects, inheritance and polymorphism, are not supported by database systems. A proper mapping between relational database concepts and object-oriented concepts can be made if relational database tables are linked to associations found in object-oriented analysis. Data stored in OOP objects should not as such be stored in relational databases.

Solving the impedance mismatch problem for object-oriented programs requires recognition of the difference in scale between object-oriented programs and relational database systems. In particular, relational database transactions, as the smallest unit of work performed by databases, are much larger than any operations performed by objects in object-oriented design. Therefore, objects can only represent data relating to a small portion of a database transaction. Object-oriented design can be used as a component of a system with a database, for example, as an implementation methodology for database resources. However, direct mapping between objects and some entities in databases are not possible without running into the impedance mismatch problem.

There have been some attempts at building object-oriented database systems (OODBMS) that would by default solve the impedance mismatch problem. They have been less successful in practice than relational databases however.





  View Live Article   This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License