Sunday, April 29, 2012

OO != Computing, Newer != More modern

Have you ever heard a Java-only programmer complain about your way of solving a problem is "bad because it is not object oriented". Java is one of the (relative to Smalltalk or Lisp) new languages, hence it must be more modern, right? And ORMs are newer and hipper than those old boring outdated relational databases. Am I not right?

Newer does not equal more modern. The problem is that not too many people bother to try to understand - to take one example - why Codd invented the relational model. What were the problems he tried to solve?

Here is an excellent talk, Programming and Scaling, by Alan Kay that really drives home the importance of having broader understanding of the history of computing and be willing to learn new perspectives.

Some good quotes (it is not a "modern" OO-bashing talk, but I chose these because I find them most applicable to the ORM-mess we are in today):

"I made up the term object oriented programming, but I made it up for something different than the term stands for today."
"[Alas] in computing we are happy to not understand what most of the founders of our field actually did."
"Lots of so called object oriented languages have setters and when you have an setter on an object you turned it back into a data structure."
"One of the problems of some of these semi-new ideas is that when they got translated into C-based forms in order to be recognizable to people, the things that were like these old ideas were emphesised. So for example you got this terrible idea of having a so called object oriented system and turning it back into data structures by putting setters in, which allow the various same disasters, remote assignment statements, to be done which turns the system into a much more fragile way of thinking about things."
"Probably the most disastrous thing you can ever learn is your first programming languange, even if it is a good programming language. The reason is that it tends to be [your internal model of] computing."
"Whatever it is that we think we know today, we should shut it of periodically and see if we can find other things to learn about."

7 comments:

  1. "...I choosed..."

    No. You chose. It is one of a couple hundred slightly irregular English verbs. And actually it isn't even really irregular. It is really just a different conjugation pattern with a vowel change, just like you know it from the other Germanic languages, like Swedish and Danish ;)

    ReplyDelete
  2. "And ORMs are newer and hipper than those old boring outdated relational databases. Am I not right?"

    That doesn't make a lot of sense, since ORM's are an abstraction layer on top of a database of your choosing... probably a relational database. They aren't competing notions.

    ReplyDelete
  3. Khalid is correct. OP's entire point is undermined by his misuse of ORM vs RDB which are not two opposing concepts but rather two layers which work together. The argument makes no sense, it's like saying "I don't like my skin because of my muscle".

    http://qkme.me/3p1jfz

    ReplyDelete
  4. No he is not.

    An ORMs and DBs do not "work together", only superficially. And ORM is akin to what in design pattern parlance they call a "Facade".

    It changes the data, and questions about the data (queries) from the rigorous math of relational modeling to the arbitrary OO model as implemented by the programmer.

    So it's not like saying "I don't like my skin because of my muscle", but more like saying:

    "I don't like this foreign language interpreter because he changes what I say, and he also distorts what the other person is telling me".

    ReplyDelete
  5. I think it would be a more valid comparison to compare ORM and SQL.

    ReplyDelete
  6. @peterfirefly
    Thanks, corrected.

    @Unknown
    Really, we're debating computing with memes now? Guess it is easier than making actual arguments.

    It is not like saying "I don't like my skin because of my muscle", it is more like saying "I like my skin, it protects my guts. Please don't put another layer of gut on top of it."

    If we listen to Dr. Kay and call "objects" for what they really are: mutable data structures, we should not call it Object-Relational Mapping, we should call it Mutable Data Structure - Relational Mapping. And that doesn't make a lot of sense, does it? The mutable data structures (or graphs) was what the relational model tried to shield us from, based on mathematical rigor.

    I don't know what a comparison between ORM and SQL would look like but a few random thoughts:
    * SQL takes some liberties with the relational model but I guess it is close enough
    * As ORM is such ill-defined term we must chose a particular implementation to make a detailed comparison
    * Here is a comparision: SQL is declarative and uniformed / ORM is imperative and arbitrary

    ReplyDelete