Book a Demo

Author Topic: How to mark a class or method as "internal"?  (Read 4729 times)

Emilio

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
How to mark a class or method as "internal"?
« on: February 05, 2009, 08:08:02 pm »
I guess this is not envisioned in standard UML (right?) but I was wondering about it anyway.

In my design I need to mark certain classes and sometimes certain methods in a class as "internal" which means they are not available from outside that package.

I don't see any attribute for doing that so has anybody found a way to properly emulate or depict that in a design? I need that the developers properly interpret what is intended by the design.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: How to mark a class or method as "internal"?
« Reply #1 on: February 05, 2009, 09:16:27 pm »
Doesn't "internal" mean Scope=Package? At least when the package represnets a .Net assembly.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to mark a class or method as "internal"?
« Reply #2 on: February 05, 2009, 11:53:03 pm »
Yes, sort of. It could also be taken to mean something like Friend, depending on the language and implementation you target. At best it is an approximation. If you find a paradigm where "internal" works perfectly, it is likely that some other concept will be out of whack. You have to fudge things a bit. Be particularly careful if you are using MDA (or any other such regime) to model across different development paradigms.

This is certainly not Sparx' fault though.

[IMHO...]

This has long been one of the big holes in UML. The visibility [containment, etc. there's a bunch of similar low-level things where the following issues apply. Read them in as appropriate where I use "visibility."] concept seems to have been closely tied to CORBA - not surprising considering the early co-evolution of the two standards. Although some 'broadening' of the UML definitions helped in support of specific languages this once again seems to have been limited to languages that mapped closely to CORBA (such as C++ and then Java).

UML 2.x was an opportunity to rethink this aspect of modeling. Sadly, this seems to have been missed. Propagating the limitations of the UML visibility implementation does prevent breaking older models, but at the cost of making so many future models approximations at best.

To make matters worse, UML does not provide a 'first line' method to extend the visibility concept. Thus visibility limitations tend to be incorporated into profiles and such rather than eased.

Sigh...
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8089
  • Karma: +118/-20
    • View Profile
Re: How to mark a class or method as "internal"?
« Reply #3 on: February 06, 2009, 08:27:59 am »
If you have a class language set to C#, EA will allow you to set scope/visibility of the class and its members to internal, despite the UML restriction on visibility.

Actually, the relevant list of visibilities should be provided for any of the supported language.

Emilio

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: How to mark a class or method as "internal"?
« Reply #4 on: February 06, 2009, 09:11:40 pm »
If you have set it to C# you can set methods to delegate, internal, new, override, sealed and virtual. That is available on the Advanced button of the Method Options dialog

However, there is no such thing for class level. If you open the class properties window there is no way to specify "internal", the Advanced button brings a small generic dialog which only allows to set these: Is Leaf (sealed class), Is Root, Is Specification and Is Active (main entry point).

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: How to mark a class or method as "internal"?
« Reply #5 on: February 06, 2009, 09:20:52 pm »
Quote
If you have set it to C# you can set methods to delegate, internal, new, override, sealed and virtual. That is available on the Advanced button of the Method Options dialog

However, there is no such thing for class level. If you open the class properties window there is no way to specify "internal", the Advanced button brings a small generic dialog which only allows to set these: Is Leaf (sealed class), Is Root, Is Specification and Is Active (main entry point).

But there is. If you set the language of a class to C#, the contents of the Scope combo box on the standard properties dialog will change to a C# specific list including "Internal" and "Protectd Internal".