tags:

views:

32

answers:

2

Other than Linq, have their been any other attempts to integrate relational features into an object oriented language itself, rather than just the libraries?

UPDATE On of the most obvious examples is one-to-one, one-to-many or many-to-many relations. Then you can also consider relationships having properties themselves.

+2  A: 

Not to my knowledge. In fact, LINQ itself isn't particularly "relational" in the original "Codd" sense of the word. (SQL isn't either, but that's another story.)

Just to set the tone, LINQ doesn't even have a concept of a relation (loosely-speaking, a set of name/value tuples conforming to a heading, which is a name/type tuple). It deals with sequences rather than sets and objects instead of tuples. Even anonymous objects aren't the same thing as named tuples in the relational model sense, since new { b = 2, a = 1 } is not only not equal to new { a = 1, b = 2 }, they aren't even the same type!

To be fair, LINQ is a huge improvement over the data access train wrecks of the past 40 years, but it is just a teeny-tiny step in the right direction, and I suspect there is no intention of taking any further steps. In fact, LINQ-to-EF seems to me to be a huge step in the wrong direction, towards OO modelling and away from the relational model (of course, not everyone will agree with me on that one ;-).

Marcelo Cantos
A: 

There is Embedded SQL in C for postgres: http://www.postgresql.org/docs/8.4/interactive/ecpg.html

But I never used it myself.

In most cases, a simple library does a good to access SQL databases, and provides a good separation between "relational" and object-oriented worlds (though, as Marcelo Cantos stated, SQL in fact is not relational in the original theoretical sense..).

However, maybe you are searching for something to "map" between relational and object-oriented? There is a technique called Object oriented mapping that creates some kind of object-oriented view to relational databases (see http://en.wikipedia.org/wiki/Object-relational_mapping). But be warned, that this may sound nice, but in practice creates some problems (see http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch for details).

frunsi