Re: Object-oriented thinking in SQL context?

From: Bob Badour <>
Date: Thu, 18 Jun 2009 01:45:05 -0300
Message-ID: <4a39c654$0$23737$>

Marshall wrote:

> On Jun 17, 9:06 am, Bob Badour <> wrote:

>>Marshall wrote:
>>>On Jun 17, 4:45 am, "Nilone" <> wrote:
>>>>"Bob Badour" <> wrote in message
>>>>>>Think 'class' ~ 'relation' (table)
>>>>>But that would not only be a blunder but a great blunder.
>>>>I'd like to clarify this for anyone coming from the OO side.  If you map
>>>>class to relation, you're breaking the OO rule of encapsulation and reducing
>>>>the class to a simple aggregate type (struct).  Presumably, you chose an
>>>>encapsulated, polymorphic abstraction device for a reason, or did you do so
>>>>just because you (or somebody at your company) read Lhotka's book?  Classes
>>>>map to domains (types) in the relation model, but be aware that subclassing
>>>>is NOT subtyping.
>>>Speaking just for myself, when I am programming in an OO language,
>>>I map classes to whatever I feel like. OO really only provides the
>>>one unit of abstraction, the class. If the only tool you have is a
>>>class, everything looks like an object. Or something.
>>>In other words, when I want an abstraction for something in
>>>Java, I make it a class, because that's about the only choice.
>>Does Java have no arrays or associative arrays?

> Java has primitive arrays. They are sufficiently lame that
> I don't use them much. They also aren't all that pretty
> as far as the type system goes; Java array types are
> covariant but of course array-element-assignment is
> contravariant, so you can get (runtime) errors.
> Java has a bajillion collection classes, and as such
> things go, they're actually pretty good. (Incl. dictionaries.)
> They are all class based. Java really, really wants
> you to use classes. (The anthropomorphism there
> is all in my phrasing; what I mean is that the language
> design makes the use of classes easy and doesn't
> provide much else to use.)
> Marshall

One could use a dictionary to implement name-based plain composition, though. Is that correct? Received on Thu Jun 18 2009 - 06:45:05 CEST

Original text of this message