Book a Demo

Author Topic: Friend classes  (Read 5260 times)

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Friend classes
« on: November 07, 2009, 12:31:12 am »
How do I model a friend class in EA?

I tried putting "friend class foo;" in the code and then doing a code synchronize, to see how the class diagram handles it, and found that the code sync doesn't handle it at all... the diagram shows no indication of it, and if I generate code, the friend class declaration is gone.

I searched this entire forum on the keyword "friend" and got no hits.  Am I the only one who needs to do stuff like this?

EA version is 7.1.833.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Friend classes
« Reply #1 on: November 07, 2009, 12:36:03 am »
Eric,

In EA you are modelling in UML.
UML doesn't know "friend" as a visibility.

I think that might be the reason why you can't use it.

Geert

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: Friend classes
« Reply #2 on: November 07, 2009, 01:44:09 am »
Quote
In EA you are modelling in UML. UML doesn't know "friend" as a visibility.

Good morning, Geert.  Thanks for the fast response.

I'm no world-class UML expert, but every UML book I have, including "The UML User Guide" by the 3A (Booch et al), mentions friend, usually as a type of dependency.  And, EA provides the <<friend>> stereotype, although with little information in "help" about what it does and how to use it (merely states that the "friend" stereotype corresponds to the "friend" keyword... not much help).

Seems like if EA provides the <<friend>> stereotype out of the box, it's logical to assume that it at least knows something about how to model friends.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Friend classes
« Reply #3 on: November 07, 2009, 03:27:45 am »
Hi Eric,

Yes it's a simple dependency stereotyped <<friend>> that indicates this in the model.
But (as with other dependency associations as well) this won't be taken in account by EAs code generation or reverse engineering features AFAIK.

WBR
Günther

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Friend classes
« Reply #4 on: November 07, 2009, 05:37:16 am »
I'm sorry but if you search the UML 2.2 superstructure you'll only find one occurrence of the term "friend".
It occurs in a table that lists the obsolete standard elements from UML 1.x

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Friend classes
« Reply #5 on: November 07, 2009, 09:56:26 am »
Quote
Quote
[size=18]...[/size]
Seems like if EA provides the <<friend>> stereotype out of the box, it's logical to assume that it at least knows something about how to model friends.
[size=18]...[/size]
And therein lay your fundamental error about EA...   :-X

Not withstanding Geert's excellent point about «friend» being obsolete, you have to get over the concept that EA should be self-consisent.

It's one of the "rites-of-passage" in using EA...  ;D

You can see it's finally got to me... ;)

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!