Re: Mixing OO and DB

From: Patrick May <pjm_at_spe.com>
Date: Fri, 08 Feb 2008 08:10:11 -0500
Message-ID: <m2hcgj4mrw.fsf_at_spe.com>


Victor Porton <porton_at_narod.ru> writes:
> I know both object oriented programming and DB (SQL). But it seems
> that these are incompatible. Or may somebody advice how to meddle
> them together?
>
> Being strong in both OOP and DB development, I am yet weak in
> writing object oriented programs which use DB.

     You're experiencing the well known "object relational impedance mismatch." There are two basic issues underlying this problem. First, the relational approach focuses on data while the OO approach focuses on behavior. Of course you can implement some behavior in an RDBMS and manage state in a OO language, but the design drivers are different.

     Second, and partly related to the first issue, when used in the same software system the two components change for different reasons. A relational schema is often used by multiple different applications and must therefore provide reasonable performance for a broad range of data creation, read, update, and deletion patterns. Even when the relational schema is embedded in a single application, state changes for different reasons and as different rates from behavior.

     The object model, on the other hand, is optimized to address non-functional requirements (NFRs) related to the problem domain. The supported behaviors may change or be extended without needing to change state at all.

> Maybe somebody may suggest me some article about mixing together DB
> and OOP?

     Because of the impedance mismatch, most OO systems use some form of object-relational mapping. A quick Google turns up this as a reasonable starting point for your research:

          http://www.agiledata.org/essays/mappingObjects.html

Regards,

Patrick



S P Engineering, Inc. | Large scale, mission-critical, distributed OO
                       | systems design and implementation.
          pjm_at_spe.com  | (C++, Java, Common Lisp, Jini, middleware, SOA)
Received on Fri Feb 08 2008 - 14:10:11 CET

Original text of this message