Re: Objects and Relations

From: David BL <davidbl_at_iinet.net.au>
Date: 6 Feb 2007 00:03:48 -0800
Message-ID: <1170749027.947584.80290_at_m58g2000cwm.googlegroups.com>


On Feb 6, 3:57 pm, "Marshall" <marshall.spi..._at_gmail.com> wrote:
> On Feb 5, 9:58 pm, "David BL" <davi..._at_iinet.net.au> wrote:
>
>
>
> > A class called Employee in an OO program is sloppy. Instead it should
> > be called EmployeeModel (or better still EmployeeInfo).
>
> I strongly disagree. "Employee" is a perfectly good name for
> a class that models a real-world employee. You don't put
> "-model" on the end because everyone knows it's a model.
> No one thinks that a Java class is an actual person; the
> confusion you're decrying doesn't occur in nature.
>
> A really sharp guy I used to work with had as a pet
> peeve structs whose names ended in "info." They're
> *all* info! he would rail. He and I would regularly run
> in to people who put "-info" at the end of the name of
> every struct; it drove him crazy.
>
> Likewise, I do not end class names in "-class" nor
> variable names in "-variable" nor table names in
> "-table." It's just pointless.

My purpose was to draw attention to the semantic lie.

Confusion does occur. Consider the following

void foo(Employee* p1, Employee* p2)
{

    // Q1. What does this mean?
    if (p1 == p2) ...

    // Q2. What does this mean?
    if (*p1 == *p2) ...

    // Q3. What does this mean?
    Employee* p = p1->Clone();
}

IMO it's a moot point because the very idea to have an Employee class is wrong. RM should be used. When OO is used sensibly (say for systems programming, front ends or games development) the problem doesn't exist. For example classes named String, Stack, Image are well named. Appending "Info" or "Model" to these would be inappropriate. Received on Tue Feb 06 2007 - 09:03:48 CET

Original text of this message