Lambda the Ultimate

inactiveTopic Impedance mismatch: RDBMS and PLs
started 4/7/2004; 2:58:12 PM - last post 5/4/2004; 1:26:08 PM
Chris Rathman - Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 2:58:12 PM (reads: 12545, responses: 34)
Impedance mismatch: RDBMS and PLs
Joel's probably onto something in his rants:

Since a huge percentage of code requires access to databases, the glue (a.k.a. the connecticazoint) between the RDBMS layer and the application code is very important, yet virtually every modern programming language assumes that RDBMS access is something that can be left to libraries. In other words, language designers never bother to put database integration features into their languages.

One could argue that the problem may not be in the programming languages per se, but rather with SQL itself. But if one accepts SQL as a given, then you'd have to admit that most of the efforts of static programming language checks (Java, C#, etc), are doomed to using SQL as a dynamic language check as the commands are just passed around as strings and not checked until runtime.

(As a preemption, he does say in the footnotes):

In functional languages like lisp the syntax layer is so light that you could probably implement very good RDBMS shims in ways that feel almost native. Especially if you have lazy evaluation of function parameters, it's easy to see how you could build a "where" clause generator that used the same syntax as your "if" predicates.
Posted to admin by Chris Rathman on 4/7/04; 2:59:20 PM

Daniel Yokomizo - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 4:23:08 PM (reads: 1638, responses: 0)
But if one accepts SQL as a given, then you'd have to admit that most of the efforts of static programming language checks (Java, C#, etc), are doomed to using SQL as a dynamic language check as the commands are just passed around as strings and not checked until runtime.

Haskell DB comes to mind. Static programming language checks all the way.

Pseudonym - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 6:20:48 PM (reads: 1608, responses: 0)

But if one accepts SQL as a given [...]

...which is something which I most certainly do not accept. This is possibly because I work with Z39.50 for a living.

Antony Blakey - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 7:00:44 PM (reads: 1599, responses: 0)
In other words, language designers never bother to put database integration features into their languages.

This is not true - there are/have been many languages that included sophisticated handling of persistent data.

At one extreme there were languages developed during research into orthogonal persistance that focussed on lessening or, in some cases, completely removing the distinction between transient (in-memory) and persistent (disk) data.

There have also been a number of languages that elevated relational data access (and other more expressive persistent data models) into the language itself.

PL/SQL et al obviously have db integration features, as does COBOL (although that's obviously not 'modern').

The very few languages (C/C++/Java/C#/VB) that are in significant commercial use are not really representative of language designers efforts - many more languages are designed than used, so maybe the question shouldn't be about why language designers don't include such features (they do), but rather whether interesting language features preclude widespread adoption, especially with the democratization of programming. My gut feel is that adding features as Joel suggests involves considerably more changes ala typing, transactions, exception handling etc, than simply elevating APIs to the status of statements, and the resulting language starts to experience combinatorial explosion of semantic weight (and problems).

andrew cooke - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 8:17:03 PM (reads: 1569, responses: 0)
(hmm - from lynx i can't seem to reply to individual comments)

round here, foxpro is fairly popular i believe. i think that has significant database integration (but may be wrong - never used it).

Ian Bicking - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 8:25:22 PM (reads: 1570, responses: 0)
While being able to create WHERE clauses and the like in native manners would be a nice feature (achievable with lazily evaluated expressions that can be introspected), it's only a part of the problem.

The relational model is challenging to deal with in a way that makes sense in modern programming languages. It works pretty well when you are trying to select data, but trying to relate those selects to updates or other operations is difficult. Typically all we have are bare names, which don't necessarily reflect where the data comes from or how it would be changed, or how it is related to other parts of the select results. Other operations like left joins -- and really even joins -- aren't part of the basic metaphors of most languages, which expect things in terms of objects and simple data structures.

Not that it isn't a worthy goal to make RDBMS access more natural, but I think the problems are more challenging than just syntactic. *And* I think the relational model isn't natural for most programming tasks or most programmers -- a language based around set theory and the relational calculous isn't going to get very far, because people are willing to use that for database access (e.g., SQL, PL/SQL, etc), but they aren't going to use it for general programming tasks.

Avi Bryant - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 11:26:52 PM (reads: 1530, responses: 0)
"It works pretty well when you are trying to select data, but trying to relate those selects to updates or other operations is difficult. Typically all we have are bare names, which don't necessarily reflect where the data comes from or how it would be changed, or how it is related to other parts of the select results."

Ah, but that's where having the "lazily evaluated expressions that can be introspected" is so useful - you can use that introspection to know something about the results as well as to generate the query in the first place. So, no, if you do it right you have much more than bare names.

I really need to write more about the stuff I'm doing in this area, but for now see: http://www.cincomsmalltalk.com/userblogs/avi/blogView?searchCategory=databases

Josh Dybnis - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/7/2004; 11:33:53 PM (reads: 1534, responses: 0)
Polymorphic type inference for the relational algebra
Jan Van den Bussche, Emmanuel Waller

Abstract: We give a polymorphic account of the relational algebra. We introduce a formalism of ``type formulas'' specifically tuned for relational algebra expressions, and present an algorithm that computes the ``principal'' type for a given expression. The principal type of an expression is a formula that specifies, in a clear and concise manner, all assignments of types (sets of attributes) to relation names, under which a given relational algebra expression is well-typed, as well as the output type that expression will have under each of these assignments. Topics discussed include complexity and polymorphic expressive power.

Quote: In this paper, we do type inference for the relational algebra. The relational algebra is very different from the programming languages usually considered in type inference ... The set-based nature of relation types, and the particulars of the standard relational algebra operators when viewed polymorphically, present new challenges. As a consequence, our formalism of type formulas is drastically different from the formalisms used in the theory of programming languages.

bryan rasmussen - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 2:28:38 AM (reads: 1482, responses: 0)
'which is something which I most certainly do not accept. This is possibly because I work with Z39.50 for a living.'

So are there any languages in which Z39.50 has a better integration than just being passed around as strings?

David B. Wildgoose - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 2:58:43 AM (reads: 1475, responses: 1)
A database table is a list of records.

Haskell (amongst others) contains powerful techniques for processing lists.

If the compiler could utilise indices when processing list comprehensions we wouldn't need SQL, we would have a native (and natural) means for querying databases built in to the language.

Of course, that then leads to the thorny problem of multi-user database transactions in a language that eschews state.

But it's a start...

Luke Gorrie - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 3:47:26 AM (reads: 1458, responses: 0)
If the compiler could utilise indices when processing list comprehensions we wouldn't need SQL

BTW, Erlang has an application called "Mnemosyne" which is an optimizing compiler from list comprehensions to Mnesia database calls.

I haven't used it much. When the DB is all in ram and in your address space you can just make as many little calls as you like and write your queries as regular functions - no intrinsic need for a DSL.

Daniel Yokomizo - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 6:46:33 AM (reads: 1414, responses: 0)
A database table is a list of records.

I disagree, because I may be a little bit pedantic, but a database table is a tree of records. This tree may be shaped as a list but it isn't necessary and for ordered records (i.e. things with index) we may use binary trees and have better performance.

Haskell (amongst others) contains powerful techniques for processing lists.

Being pedantic again, techniques for processing arbitrary algebraic datatypes, including lists and trees. We may not be able to use list comprehensions with any algebraic datatype but we can make their usage as simple with other techniques (e.g. combinators).

Of course, that then leads to the thorny problem of multi-user database transactions in a language that eschews state.

Hmmm, we can embed these issues in monads, both database access (client side using IO) and transaction processing (server side using State monad to build the transaction).

A related discussion

David B. Wildgoose - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 8:01:14 AM (reads: 1371, responses: 0)
a database table is a tree of records

OK, my time to disagree. The ordering of the records is a property of the indices used by the table - the data itself is essentially unstructured. Each index could be stored in a different fashion, (including of course tree structures), but it should not be limited to such a form.

As far as I am aware there is no reason why List Comprehensions couldn't be made to work with a generic DatabaseIndex Typeclass.

A State monad would be appropriate for the database server because to ensure database integrity all database commits ultimately have to be single threaded.

On the client machine however, my gut feeling is that it isn't so simple. I don't think it makes as much sense to force a single threaded approach when connecting to multiple database servers on multiple machines each of which probably has hundreds/thousands of users. Multi-database commits can be a thorny issue at the best of times, and I don't think this is an issue that has been satisfactorily addressed yet.

Kory Markevich - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 11:11:45 AM (reads: 1299, responses: 0)
David: A database table is a list of records.

Daniel: ...a database table is a tree of records

You may want to state what kind of data model you are each referring to. I had assumed it was the relational data model but in that case you're both wrong; the value of a relation is defined as a set (unordered!) of tuples. I don't have reference material handy so I can't point to anything definitive, though the wikipedia has a pretty good entry on it.

I don't think it makes as much sense to force a single threaded approach when connecting to multiple database servers on multiple machines each of which probably has hundreds/thousands of users.

I would hope that the DBMS would be handling these details (and provide a sufficient interface, of course.) Clients of the database should be as isolated from such physical concerns as possible, and having the client applications responsible in any way for data integrity would be a disaster. Is there anything language/application would need beyond ways to indicate the start and end of a transaction, and a way to know whether it was a success or failure?

David B. Wildgoose - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 1:41:15 PM (reads: 1240, responses: 0)
the value of a relation is defined as a set (unordered!) of tuples

Isn't that what I was saying? That data is completely separate from its sequencing and access via indices?

As for the DBMS stuff, remember that this whole thread is about integrating database access and manipulation into the language, hence my "gut" feeling that it isn't that simple on the client.

xeo_at_thermopylae - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/8/2004; 8:19:56 PM (reads: 1135, responses: 0)
"Those who fail to study logic are doomed to recreate the errors of past logicians." - someone else has surely said that...

Relational databases have a mathematically model that is the same for all programming languages. In contrast each OOP database or OOP language implementation model is different; it is impossible to design a single OOP interface to relational databases (other than a trivial re-implementation of the relational model itself) that would be optimal for all OOP models. Each OOP-relational interface must be hand-rolled because of this deficiency.

This is the fatal and largely unrealized flaw in OOP that will eventually lead to its abandonment. OOP recreates (for languages) the database debacle that culminated in CODASYL network-style databases decades ago and that was cleaned up by the ensuing arrival and overwhelming acceptance of relational databases. However the enlightenment that has occurred for databases has not yet arrived for programming languages, and it will take another decade for language developers to realize they took a wrong turn when they went down the OOP path.

David B. Wildgoose - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/9/2004; 1:51:03 AM (reads: 1092, responses: 0)
I agree that OOP is probably a bad fit for databases, but the same could also be said for SQL.

I have to hold up my hand and admit that my paid work is in a 4GL RDBMS, so I think I may have some insights into what works in the "Real World".

I don't use SQL a great deal because it's a bad fit for a lot of database work. Many "set" operations are actually operating on single records. Also, SQL lacks basic concepts like a "screenful" of records. A better approach in these circumstances is to define a query across the tables you need whilst applying constraints to the records fetched, and then manipulating them in turn as appropriate. Sounds a lot like a list comprehension, doesn't it?

Database transactions have to be "atomic" as far as possible, but at the same time wholesale database locking during user access is unacceptable in massive multi-user systems. This means that you have to be aware that the data you are working with may have mutated outside of your control. With respect to Haskell, you then have some of the problems inherent with state in a language that has not been designed with these in mind.

My own inclinations are that many of these can be solved by adding proper parallel semantics to Haskell, and indeed these will prove useful in any event upon future multi-core multi-CPU machines. Languages like Oz have thought and are thinking about these "practical" aspects, I just wish there was more interest in the Haskell community. The "Real World" can be messy, and doesn't always pare down to a clean mathematical model.

Boy am I going to get flamed now...

Frank Atanassow - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/9/2004; 7:33:38 AM (reads: 1064, responses: 0)
A few years ago, I attended a talk that Maarten Fokkinga gave to an audience of functional programming people (my group) about (binary table) databases which used some elementary category theory; the corresponding paper is Towards a Theory of Moa. I don't know much about databases but, based on that, I formed the opinion that a programming language which is designed from a categorical standpoint should be able to handle databases in an elegant manner which does not involve bolting on ad hoc domain-specific extensions like SQL syntax or whatever. I'm not sure what sort of extensions/changes are required, though. The paper is worth reading if you are into category theory.

Neel Krishnaswami - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/9/2004; 3:03:41 PM (reads: 1016, responses: 1)
In regards to applying categorical principles to databases: I haven't read the paper on Moa yet, but I really liked Torsten Grust's PhD thesis, Comprehending Queries. It's a very cool application of categorical principles to the problem of optimizing database queries. One of the neat things about it is that his internal query language uses comprehension syntax, and the query optimizations are all equational transformations that would be valid for Haskell's monad comprehensions.

He does make some use of the two extra equational laws that distinguish sets from lists, so I imagine that you'd want a programming language to offer some sort of specification/checking for legal equational transformations. That's a pretty generic and non-ad-hoc feature, though. Done right, I bet a compiler could optimize the database queries it sends to the database engine as part of its ordinary optimization passes. :)

Sjoerd Visscher - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/10/2004; 4:00:10 AM (reads: 973, responses: 0)
The PDF you link to is only a part of the thesis. The complete thesis is here I think.

William Cook - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/11/2004; 7:00:29 AM (reads: 843, responses: 0)
I am working on this problem. I will post some responses to the list later, but I would also appreciate comments on this paper:

Safe Query Objects: Statically-Typed Objects as Remotely-Executable Queries, with Siddhartha Rai. Submitted to OOPSLA 2004.

andrew cooke - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/11/2004; 9:32:36 AM (reads: 827, responses: 1)
i don't think anyone has mentioned k and kdb. there's background here and a paper on Time Series in Finance: the array database approach.

i'm pretty sure i read somewhere recently the claim that k manages the largest database(s?) in existence (i've been reading around a bit on concatenative languages). that claim, incidentally, is probably untrue, since i doubt it's used for babar (in astronomy we're copying from high energy physics in anticipation of the next generation of survey telescopes, which will generate huge amounts of data - some may even process the images in realtime and store only measured parameters, discarding the raw data).

William Cook - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/11/2004; 1:55:01 PM (reads: 802, responses: 0)
Impedance mismatch is interesting because there is no shortage of solutions, yet very little understanding of what the problem actually is. In the paper mentioned above we present a new anaylsis of impedance mismatch.

As for comments in this forum:

The relational model defines a table as a set of tuples. Most implementations use various forms of binary trees for indexes into the list of tuples, but since there can be multiple indexes it seems strage to say that a "table is a tree of records". Often the indexes contain a subset of the data in the record: sometimes a query can be executed by only examining the index, but sometimes multiple indexes and the actual tuples are accessed.

I tend to think of the relational model as "assembly language of data". One key similarity is that data does not have an inherent interpretation, but is only interpreted by they operations applied to it. For example, a word of memory is interpretated as an integer or a float by an assembly instruction, not by its inherent type; similarly, values in a table are interpreted as keys/foreign keys during a join operation, but the semantics of the relationship is not stored in the database -- it is only in the query. As a result, I prefer to use the Entity-Relationship (ER) Model, since it assigns more meaning to the data in the database.

In either case, I don't think that typing problems are the central issue in impedance mismatch. As many have pointed out, most languages can represent lists of tuples, and NULL data values are not really a fundamental problem for programming languages. In addition, the ER model maps very naturally to object-oriented languages.

As for connecting data from the database with its source, this is an important issue. But object-oriented languages make this easy -- just wrap the data in an object that keeps track of its source (this is done in most OO/DB interfaces, like ADO). I suppose you could use "lazily evaluated expressions that can be introspected" to do the same, but its not the only way.

As for the idea that "memory is so cheap that we can just load everything and use normal iteration" -- I don't buy it:

  • Iterating through millions of records to find the few that are needed is not efficient; indexes can still help a lot.
  • Straightforward queries often involve nested iteration (think a million squared); query optimization with indexes can reorder these operations to be very efficient.
  • Transaction models require isolation: as a result every object a transaction touches must be added into the transactions working set -- a linear scan of all objects touches everything.

So, what is the fundamental problem? The desire for a uniform (object-oriented) semantic model while still supporting the efficiency of query optimization. This is why none of the object-relational/persistent object systems have been fully successful: they are conceptual clean but don't provide a way to leverage the power of database engines for query optimization. The alternative, ODBC and its descendants, let you use the power of the database but introduce a complete semantic disconnect between the programming language and the query language. Even the advanced "query objects" in systems like Hibernate and JDO are really no better than SQL strings, since they are still constructed and verified at runtime.

Our paper is a first step toward a new approach to solving this problem. If anyone has comments, I'd love to hear about them.

Chris Rathman - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/12/2004; 9:54:17 AM (reads: 716, responses: 0)
re: comments. The description of the problem and the nature of the solution is spot on (and I think it's of the nature that Joel was originally searching for). Not sure if I can add any intelligible feedback, but...

Buffering: I'm assuming that the collections returned by the Query Objects are lazy? That is, is the collection returned immediately upon receipt of the first tuple, acting like a stream rather than a fixed list. Or must I await for the full collection to be completed before the method releases the results. Something along the lines of iterator seems to come to mind.

Joining: What is it about the Join operation that causes grief? Harking back to RPG days, we would define a join in a similar DDS format, and then that join could be used in the same manner as a native table. That is, why can't Query Objects be Views, Procedures, or Functions, rather than just a raw table definition (indeed, the table may be little more than a view from the database side).

Overall, interesting work. Do you have the code for the example posted on the web? (might give a better feel for how the pieces fit together).

William Cook - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/12/2004; 11:47:36 AM (reads: 704, responses: 0)
Thanks for your feedback. Yes, the results are returned as a stream, not a complete collection. It is typical to use a specialized Collection class that returns a stream-based (read-only forward cursor) enumerator. I don't know why joins are considered such a problem; but they clearly have no place in the ordinary OO programmer's worldview. Joins represent bi-directional links (every employee has a manager, every manager has a set of employees). They also link across multiple levels.

As for the code, it is not on a web site yet. It will be eventually, but it is not there yet.

Michal Moskal - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/14/2004; 4:01:15 AM (reads: 598, responses: 0)
Using a language with macro capabilities like Scheme or Nemerle you can just pass the SQL queries as text and have macro send them to database for validation. And even let the database discover types of returned columns and use that information in the macro (for example to define values with corresponding types in the source language). This should work well in practice (eliminate simple mistakes in SQL, simplify code a bit), but we havn't implemented it yet in Nemerle, so I'm not sure.

Now, having some nice theoretical model that fits well with the rest of the language (like in Haskell DB) seems appealing. BUT it is far from being simple for the avarage programmer (maybe not avarage Haskell programmer, but surely avarage Java or C# programmer :-). Simply SQL is something known, and combinators, you know...

Neel Krishnaswami - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/15/2004; 8:50:55 AM (reads: 529, responses: 0)
Hi Michal,

What you suggest is a good idea, and would definitely reduce the number of bugs. But unfortunately, you can't rely on this to eliminate any dynamic checks, though, because the database schema can change and invalidate the analysis the macro did. :( I know Oracle keeps track of which tables stored procedures reference, and invalidates any procedures that do things that don't make sense any more. Unless you can hook your linker into the database the same way, you have to be conservative.

Kamil Skalski - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/15/2004; 12:33:36 PM (reads: 516, responses: 0)
The problem is that any compile-time checking is vulnerable for database changing before program's real execution. You simply have to recompile your program after this change. BTW, it is nothing enormous - after you rename table in DB, you have to change all SQL queries mentioning this table... unless your change in DB is "schema-compatible" ;-)

The same argument holds for shared libraries in your system, you cannot change them without interferring with program which use them, no matter how secure and pure is language it was wrote in.

Of course one could think about implementing relational model or SQL validator to check SQL statements... BUT, database is such a validator itself... No mentioning all the problems such as "how to retrieve type of stored procedure", "how to be compatible with that, that and that database system"...

Macro feature of Nemerle just gives an easy way of implementing some validator of SQL statements. You can do this in many ways, actually "send to database" approach took me 267 lines of code and it seems very powerful even in its prototype state. :)

Patrick Logan - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/16/2004; 2:28:11 PM (reads: 471, responses: 0)
I don't know why joins are considered such a problem; but they clearly have no place in the ordinary OO programmer's worldview.

I've not heard that joins are a problem. In fact I've heard little evidence of them being brought into an OO language at all.

Maybe there are citations of this in the paper? I've not read it yet.

Joins represent bi-directional links...

Hmm. There's a deeper discussion here.

Sjoerd Visscher - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/17/2004; 6:07:23 AM (reads: 455, responses: 0)
Joins represent bi-directional links...

Hmm. There's a deeper discussion here.

Yes, enlighten me. What is it exactly that joins are supposed to do or what problems should they solve in an OO language?

Chris Rathman - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/17/2004; 9:06:36 AM (reads: 447, responses: 0)
The topic's not about what's best for OO languages - it's about bridging the gap with relational databases. Joins are quite useful on the relational side of the chasm.

M.J. Stahl - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/22/2004; 5:18:47 AM (reads: 385, responses: 0)
I sent Joel an email on what is going on with the modifications we are making to JavaScript.

And I am sorry Ehud. I completely agree with you about languages (concerning C Omega), vaporware (for we only have a few small mods to the JS internals), and languages starting with a C (thankfully though, the language is named Color =).

I personally am not a good SQL programmer, and we though about how mainly languages one has to know when following an MVC website design strategy (3, maybe 4 if you use and count XML as a different language than HTML). Our fix starts with access databases using a URI.

x = <mysql://usr:passwd@domain.com/>

And being that I view the '.' operator much like a tree accesor, we could access a field in a table like so.

x.database.table[0].field

The array of course references the row of the table. My only problem with this is the mental mapping between rows starting at one and the historical precedence of arrays starting at 0.

Thankfully I was on the same page with Joel, and thought 'if' and 'where' acting very much alike. Now mind you this does not fix the problem that is addressed in the title of this posting, but I personally believe it is a step in the right direction.

Olivier Lefevre - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/25/2004; 11:49:32 AM (reads: 270, responses: 0)
FYI, K is not a concatenative language; it just happens that a K old-timer is very active on the concatenative mailing list. IMO K is best described as a hybrid of Scheme and APL.

Marius Amado Alves - Re: Impedance mismatch: RDBMS and PLs  blueArrow
4/29/2004; 2:18:03 PM (reads: 216, responses: 0)
"The topic's not about what's best for OO languages - it's about bridging the gap with relational databases."

A way of bridging the gap is of course with persistent languages. With the current advent of big RAMs (and swap space anyway), the variant known as "prevalent" becomes feasible. Basically all data are normal objects of the language held in main memory as usual but a means exist to make them all survive program termination, and restore to the last state upon restarting. The Prevayler system does this for Java. My Mneson database system (Ada + DSLs) is similar in that all data is in main memory except non-tiny strings.

Someone mentioned Foxpro. Foxpro is Clipper with Windows. Clipper is one of the once called xBASE systems, which included dBASE, and is essentially SQL.

William Cook - Re: Impedance mismatch: RDBMS and PLs  blueArrow
5/4/2004; 1:26:08 PM (reads: 166, responses: 0)
Some comments:

RE: Using a language with macro capabilities like Scheme or Nemerle you can just pass the SQL queries as text and have macro send them to database for validation. This could provide compile-type checking if the text is sent to the database at compile time, when the macro is expanded. Requiring the compile step of a program depend upon having a running instance of the database is not inconeivable, but it certainly makes configuration management harder. Also, some queries are composed or written at runtime (see my paper mentioned above for a typical example); I am not sure how macros would handle this case.

RE: Yes, enlighten me. What is it exactly that joins are supposed to do or what problems should they solve in an OO language? I don't think that joins should go into an object-oriented language. I was merely pointing out that joins are used in the same way that inter-object pointers (links) are used in OO. In a database the relationship between two rows is bi-directional: joining an emplyoee table to a department table can be used to find 1) the department of an employee, or 2) the employees in a department. Changing the department of an employee automatically changes the set of emplyees in the old and new departments. This kind of referential consistency is automatic due to the normalized data reprentation.

RE: persistent languages. I have two comments: SQL is in effect a domain-specific language for describing search operations that can be very efficiently optimized based on indexes, etc. Most persistent object systems don't provide equivalent optimizations -- you could ague that its all in memory so it doesn't matter, but I am not sure I believe it. Second, it is good to have redundant live servers for availability and scalability. I don't see how memory-mapped persistent object systems can be distributed/replicated effectively.

RE: Access to DB via URL. This has been done many times before. SQL server includes something like this as a standard option. I don't see how it solves anything. It is not as expressive as real SQL, or admit the same kinds of optimizations in real SQL. You might as well just map your database to a bunch of Javascript arrays with data in them, and be done. For some this might be a solution to impedance mismatch, but not for me.