Re: UML "OR" Composition Question

From: Michael Rauscher (michlmann_at_gmx.de)
Date: 05/21/04


Date: Fri, 21 May 2004 15:41:21 +0200

H. S. Lahman schrieb:

> Responding to Rauscher...
>
>>>> Of course can one X not be a Y _and_ a Z. And I didn't say that.
>>>
>>>
>>>
>>>
>>> Then you will have to explain to me what you meant when you said
>>> "it's wrong that one X must be a Y or a Z." In the original problem
>>> statement X only has two subclasses, Y and Z.
>>
>>
>>
>> One X may be a Y or a Z or even a X.
>
>
> That implies that one can instantiate an X without specifying a
> subclass. Though some misguided OOPLs like C++ allow that, it is a
> no-no from an OOA/D viewpoint. One can only instantiate leaf subclass

Do you have sources for this?

> instances from a subclassing relation. That is, each instance must
> completely resolve the entire tree; otherwise the properties of the
> instance would be ambiguous.

Not "otherwise". The ambiguity would be a result of the claim that each
instance must completely resolve the entire tree. Otherwise :-) there
aren't any ambiguities.

[...]

>>
>> If I understand you correctly, you'd say that because there are
>> subclasses, one must not instantiate X?
>
>
> That is correct, per my comment above.

To me, it's interesting that it is hard to prove/disprove this requirement.

E.g. one may start with a class Exception. In a later version of the
model, this someone needs a specific form of exception, therefore
extending it

    [Exception]
         A
         |
[SpecificException]

Now, you say this is wrong, because Exception is useless in this case. I
guess, that you would model this as something like

    [AbstractException]
            A
            |
  +---------+----------+
  | |
[Exception] [SpecificException]

So, I'd say from a static view you're right, from a dynamic view, it's
wrong. With static I mean, that one looks at a given (or creates an)
ultimate model. With dynamic I mean, that one extends (or may extend) an
existing model.

The problem is, that there are existing references to Exception. "All"
objects in the old model works with Exception. Therefore, if one
enforces your approach, he has to change all references to Exception
into references to AbstractException.

I'd also say, that one cannot assume an ultimate model. Therefore it
doesn't matter if there are classes, that currently don't exist or if
there are classes, that are simply not shown.

Bye
Michael



Relevant Pages

  • Re: baffled by exception
    ... > latter emulate the former? ... and it's driving me insane - I can't work out what's> wrong ... > It just seems to throw an exception, citing 'User Breakpoint' as the cause> of the exception when any C++ code tried to instantiate it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: baffled by exception
    ... > latter emulate the former? ... and it's driving me insane - I can't work out what's> wrong ... > It just seems to throw an exception, citing 'User Breakpoint' as the cause> of the exception when any C++ code tried to instantiate it. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: baffled by exception
    ... > latter emulate the former? ... and it's driving me insane - I can't work out what's> wrong ... > It just seems to throw an exception, citing 'User Breakpoint' as the cause> of the exception when any C++ code tried to instantiate it. ...
    (microsoft.public.vc.language)
  • Re: Multidimensional ArrayList how to?
    ... throws the exception, I've got the impression ... are you populating the ArrayListmembers? ... showing here is the creation of the array. ... until you explicitly instantiate them. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: COM objs problems with .net
    ... probably getting more objects from the object you created, and not releasing ... of references to other COM objects, then I would actually call GC.Collect to ... instantiate the object when the app starts, ... > an event handler), and destroy it when the app ends. ...
    (microsoft.public.dotnet.languages.csharp)