"extends" versus "aggregates" in UML CRC

This is a discussion on "extends" versus "aggregates" in UML CRC within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, This is just a trivial matter, I think the strictly technical answer is "whichever you prefer", but ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-06-2005
Kelvin Mackay
 
Posts: n/a
Default "extends" versus "aggregates" in UML CRC

Hi,

This is just a trivial matter, I think the strictly technical answer is
"whichever you prefer", but I find it interesting and I'm googling for
brick walls so I'd like to hear what the general consensus is on this

I've been trudging through the PHP docs & UML 1.5 specification to try and
figure out whether it's correct to say "class a extends b" is an extension
or an aggregation, in the context of a CRC diagram.

I've been using extends up until now, but I have a feeling that aggregates
is what I should be using. The problem is that PHP has (or had) it's own
aggregation functions, so while it could be correct in other languages,
and perhaps in PHP 5, to call it aggregation, in PHP 4 I have no idea.

I'd appreciate your opinions on this - thanks in advance

Sincerely,
Kelvin
Reply With Quote
  #2 (permalink)  
Old 02-06-2005
George King
 
Posts: n/a
Default Re: "extends" versus "aggregates" in UML CRC


"Kelvin Mackay" <kelvin@nospam.sands-design.com> wrote in message
news:opslreaw06krqzhn@snoopy...
> Hi,
>
> This is just a trivial matter, I think the strictly technical answer is
> "whichever you prefer", but I find it interesting and I'm googling for
> brick walls so I'd like to hear what the general consensus is on this
>
> I've been trudging through the PHP docs & UML 1.5 specification to try and
> figure out whether it's correct to say "class a extends b" is an extension
> or an aggregation, in the context of a CRC diagram.
>
> I've been using extends up until now, but I have a feeling that aggregates
> is what I should be using. The problem is that PHP has (or had) it's own
> aggregation functions, so while it could be correct in other languages,
> and perhaps in PHP 5, to call it aggregation, in PHP 4 I have no idea.
>
> I'd appreciate your opinions on this - thanks in advance
>
> Sincerely,
> Kelvin


Kelvin,

In PHP, we say that class B "extends class A". In UML, I think we might
call this an "association". Take a look at
http://www.objectmentor.com/resource...ssDiagrams.pdf and see
what you think.

George


Reply With Quote
  #3 (permalink)  
Old 02-06-2005
Oli Filth
 
Posts: n/a
Default Re: "extends" versus "aggregates" in UML CRC

George King wrote:
> "Kelvin Mackay" <kelvin@nospam.sands-design.com> wrote in message
> news:opslreaw06krqzhn@snoopy...
>
>>Hi,
>>
>>This is just a trivial matter, I think the strictly technical answer is
>>"whichever you prefer", but I find it interesting and I'm googling for
>>brick walls so I'd like to hear what the general consensus is on this
>>
>>I've been trudging through the PHP docs & UML 1.5 specification to try and
>>figure out whether it's correct to say "class a extends b" is an extension
>>or an aggregation, in the context of a CRC diagram.
>>
>>I've been using extends up until now, but I have a feeling that aggregates
>>is what I should be using. The problem is that PHP has (or had) it's own
>>aggregation functions, so while it could be correct in other languages,
>>and perhaps in PHP 5, to call it aggregation, in PHP 4 I have no idea.
>>
>>I'd appreciate your opinions on this - thanks in advance
>>
>>Sincerely,
>>Kelvin

>
>
> Kelvin,
>
> In PHP, we say that class B "extends class A". In UML, I think we might
> call this an "association". Take a look at
> http://www.objectmentor.com/resource...ssDiagrams.pdf and see
> what you think.
>
> George
>
>


In my understanding of UML, an extension (or inheritance) is a separate
issue from composition (or aggregation).

- Extension/inheritance describes an "is-a" relationship. e.g.

class Animal
{
int age;

function think() { ... }
function eat() { ... }
}

class Dog extends Animal
{
string breed;

function wagTail() { ... }
}

A dog *is* an animal.

- Aggregation/composition describes "has-a" relationship. This is a type
of UML association. e.g.

class Office
{
Worker manager;
Worker employees[];
Desk desks[];
}

An Office *has* a manager, *has* some employees, and *has* some desks.

Two fundamentally different concepts.

--
Oli
Reply With Quote
  #4 (permalink)  
Old 02-08-2005
Kelvin Mackay
 
Posts: n/a
Default Re: "extends" versus "aggregates" in UML CRC

On Sun, 06 Feb 2005 17:16:03 GMT, Oli Filth
<oli_filth@eatspam.coldmail.com> wrote:

> George King wrote:
>> "Kelvin Mackay" <kelvin@nospam.sands-design.com> wrote in message
>> news:opslreaw06krqzhn@snoopy...
>>
>>> Hi,
>>>
>>> This is just a trivial matter, I think the strictly technical answer
>>> is "whichever you prefer", but I find it interesting and I'm googling
>>> for brick walls so I'd like to hear what the general consensus is on
>>> this
>>>
>>> I've been trudging through the PHP docs & UML 1.5 specification to try
>>> and figure out whether it's correct to say "class a extends b" is an
>>> extension or an aggregation, in the context of a CRC diagram.
>>>
>>> I've been using extends up until now, but I have a feeling that
>>> aggregates is what I should be using. The problem is that PHP has (or
>>> had) it's own aggregation functions, so while it could be correct in
>>> other languages, and perhaps in PHP 5, to call it aggregation, in PHP
>>> 4 I have no idea.
>>>
>>> I'd appreciate your opinions on this - thanks in advance
>>>
>>> Sincerely,
>>> Kelvin

>> Kelvin,
>> In PHP, we say that class B "extends class A". In UML, I think we
>> might call this an "association". Take a look at
>> http://www.objectmentor.com/resource...ssDiagrams.pdf and
>> see what you think.
>> George

>
> In my understanding of UML, an extension (or inheritance) is a separate
> issue from composition (or aggregation).
>
> - Extension/inheritance describes an "is-a" relationship. e.g.
>
> class Animal
> {
> int age;
>
> function think() { ... }
> function eat() { ... }
> }
>
> class Dog extends Animal
> {
> string breed;
>
> function wagTail() { ... }
> }
>
> A dog *is* an animal.
>
> - Aggregation/composition describes "has-a" relationship. This is a type
> of UML association. e.g.
>
> class Office
> {
> Worker manager;
> Worker employees[];
> Desk desks[];
> }
>
> An Office *has* a manager, *has* some employees, and *has* some desks.
>
> Two fundamentally different concepts.
>



Thanks for your replies - the document & example have certainly made
things clearer.
In the PDF I noticed a relationship that I somehow hadn't considered -
"inherit". I think this most accurately describes the 'extends' operation,
so I'll use it from now on.
Thanks for your clarification of aggregation, I'll find it very useful now
that I know how to use it!


Kelvin
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:42 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0