Re: Mixing OO and DB
Date: Thu, 7 Feb 2008 23:58:11 -0800 (PST)
Message-ID: <081cbab9-89f6-4459-9e5c-3346e6d96e99_at_s37g2000prg.googlegroups.com>
On Feb 7, 9:35 pm, Victor Porton <por..._at_narod.ru> wrote:
> 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.
>
> Maybe somebody may suggest me some article about mixing together DB
> and OOP?
Whether OO and a relational DB is incompatible or not, depends on how you use OO. In the relational camp, objects and relations are considered being orthogonal features. A relation (table), is a relation between values (objects). In fact, classes are one way of defining types (domains) needed in the relational model. For example, the datetime type or a currency type may be defined using classes.
One other important thing is that objects used in relations must be immutable. Objects are values. If you start using mutable (data) objects in multi-user environments, you will soon encounter a lot of concurrency issues, that the RDBMS is supposed to do for you instead.
Objects and classes can obviously be used successfully for other things not related to data management. For example, classes/objects are suitable for buildning a GUI.
//frebe Received on Fri Feb 08 2008 - 08:58:11 CET