Fog Creek Software
g
Discussion Board




Impendance mismatch

Hi all,
The impedance mismatch between SQL and high level programming languages can be minimized if the language supports closures.
Groovy    http://groovy.codehaus.org/    supports SQL, very nicely, using closures.

nil
Thursday, March 25, 2004

http://groovy.codehaus.org

Joel Spolsky
Fog Creek Software
Thursday, March 25, 2004

Forgive me, but what about FoxPro?

I am going to go take a shower now.

Gp
Thursday, March 25, 2004

[rolling eyes]

Closures *demand* a ubiquitous runtime for correct evaluation. This is pretty difficult to arrange for in most large-scale computing solutions. Won't be running Groovy inside Oracle anytime soon, I suspect.

(Not that I don't love them.)

Next thing that people will suggest is RPC-based remote objects for evaluation of said closures.

[running away while ducking]

Still waiting for LISP
Thursday, March 25, 2004

I can't imagine anything much more ubiquitous than the JRE, upon which Groovy runs.

Jason Dufair
Thursday, March 25, 2004

To *meaningfully* run Groovy on top of an Oracle-embedded JRE, the implementation of its runtime would need to be tightly integrated into the implementation of the Oracle database kernel. At that point, you've got a pretty interesting semantic mismatch going - either those Java frameworks or those pesky database behaviors are going to have to give...

As far as ubiquity goes, last time I checked, SQLServer was unlikely to embed the JRE.

[still dodging]

Still waiting for LISP
Thursday, March 25, 2004

But why the need to embed or run "on top of"?  If you have a decent closure implementation, you run "alongside of" and with a decent persistent object framework, are off to the races.  I think the "impedance mismatch" is between underpowered languages like Joel mentions (C#, Java, etc.) and getting work done efficiently.

Jason Dufair
Thursday, March 25, 2004

If you are going to actually *do* something with the data within the closure, you're going to need, at the very least, a shared notion of datatypes and shared semantics for assignment (including things like whether exceptions can occur, synchronization for concurrent access, layout and overflow, etc.) And I believe that Joel's original post was suggesting much deeper integration, which would mean that the internal representation of tuples, constraints, etc. etc. would also need to match.

Anticipating another goofy tangent: presumably you're not going to go "pure functional," since the claim is that this would be useful. (You're using a database for storage, after all, and you want to include support for helpful side-effects like IO and integration with existing code.) Even if you do go functional, you still need a point in time at which the data is sucked into the closure microcosm, and an restartable transaction or some form of state recovery if it is going to come back.

Still waiting for LISP
Thursday, March 25, 2004

Joel's entire article (with the exception of one sentence) is about syntax.  So I won't "go pure functional", but I will argue that the less syntax the language has, the less impedance mismatch there is.  He even effectively concedes this point in his addendum.

As far as type-mapping, that's pretty straightforward.  You spend an afternoon doing it once and you're done.  A language designer wouldn't be able to provide this as a "built-in" anyway, as each RDBMS has it's own ideas about types.

Jason Dufair
Thursday, March 25, 2004


    Just wanted to point this out if you don't know about it: Hibernate (JDO implementation) + XDoclet goes a long way in solving this problem.

http://www.hibernate.org/

Gili Tzabari
Thursday, March 25, 2004

Why ru still waiting for LISP ?
Mr "waiting for lisp" ?

James
Thursday, March 25, 2004

Hmm. If it runs on Unix one would type

man groovy

to find out about it.

Well I thought it was amusing
Friday, March 26, 2004

I found an interesting discussion of the O/R impedance mismatch at http://www.agiledata.org/essays/impedanceMismatch.html . The way Scott Ambler describes it on this site,  the impedance mismatch isn't between languages and RDBMSes so much as it is between the OO and relational *paradigms*.  It's telling that the discussion doesn't even touch the topic of typing or query structuring. I'll avoid parroting his points, but I'll draw your attention to section 3, which I found the most enlightening. Also note that he covers a "cultural" impedance mismatch between the OO and RDBMS people- certainly an important consideration for enterprise software development.

Adam Glassman
Friday, March 26, 2004

Some discussion on the so-called impendance mismatch is here:
http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci821252,00.html

http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci828701,00.html

MR
Friday, March 26, 2004

"Programming with Circles, Triangles and Rectangles"
http://www.cl.cam.ac.uk/~gmb/Papers/vanilla-xml2003.html

"The rest of the paper considers the promotion of data access APIs into C#. The data we are interested in is XML. This is the "triangle" in the title, reflecting the tree/graph-like structure of XML documents."

Guess what the "rectangles" in the title are...

Isaac Gouy
Friday, March 26, 2004

*  Recent Topics

*  Fog Creek Home