Re: Mixing OO and DB

From: David BL <davidbl_at_iinet.net.au>
Date: Fri, 15 Feb 2008 19:43:07 -0800 (PST)
Message-ID: <d3e88835-9c6f-4b6c-abaf-58aafc22820e_at_d4g2000prg.googlegroups.com>


On Feb 16, 10:54 am, Marshall <marshall.spi..._at_gmail.com> wrote:
> On Feb 15, 5:45 pm, David BL <davi..._at_iinet.net.au> wrote:
>
>
>
> > I hope you are remembering in this discussion that I expect an OO
> > language to support at least two distinct notions of subtype. One
> > centres on substitutability of values and the other on
> > substitutability of objects. I'm reticent to say variable instead of
> > object because some people assume (by definition) variable represents
> > a value.
>
> Just butting in here, but I wanted to say that this is exactly the
> sort of complexity that makes me convinced that this whole
> main branch of programming language design is a dead end.
> Who needs all this co-variant/contra-variant, subtyping is
> not subsetting craziness? How does this help the working
> programmer get his code written?

Please butt in. I have the highest respect for your opinions!

Consider the following...

    interface GuiWindow
    {

        Rect GetRect() const;
    };

    interface TextButton : IGuiWindow
    {

        void SetText(String text);
    };

My point is that these are not value types. There is no sense in which you can think in terms of a set of GuiWindow values (or indeed a subset of these which is a set of TextButton values). In this OO design GuiWindow variables are stateful and exhibit behaviour and do not and cannot support assignment. A GuiWindow variable does complicated things like "capture the mouse" or fire events to other variables. According to C.Date a variable (only) supports assignment. Not a lot in common!

Note for example that interface GuiWindow doesn't provide an abstract method SetRect() even though all gui windows have a concept of a rectangular region on the screen. Such a method is incompatible with LSP. For example, a text button calculates the size of the rectangle based on its current text.

What do you suggest as an alternative (or are you suggesting avoiding the OO approach entirely)? Received on Sat Feb 16 2008 - 04:43:07 CET

Original text of this message