Book a Demo

Author Topic: stereotype  appears with a  strange format  (Read 6944 times)

iwt2

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
stereotype  appears with a  strange format
« on: August 17, 2010, 05:36:56 am »
Hello everyone,

When I create an element of type Interface using the API methods, and then look in the Project Browser of my EA project, the element stereotype thath I created earlier appears with a strange format:

<<my_stereotype...>> name_element

However I have noted throughout the database that the field stereotype has my_stereotype

Do you know that happens? How I can avoid those "..."?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #1 on: August 17, 2010, 08:17:09 am »
It's showing because your element has more than one stereotype, but the second on are truncated.

iwt2

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #2 on: August 17, 2010, 07:38:22 pm »
Quote
It's showing because your element has more than one stereotype, but the second on are truncated.

You're right. My test is simple:

paquete = repositorio.GetPackageByID(267);

elemento = paquete.GetElements().AddNew("name", "Interface");

elemento.SetStereotype("my_stereotype");
elemento.Update();

And it appears this in the Proyect Browser:




But you know how to remove the second stereotype?

Thank you.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #3 on: August 18, 2010, 10:25:21 am »
Hi iwt2 (real names make it easier...)  ;)

The problem may not be as you think it is...

Try this experiment:  Drag an interface off the toolbox.  Then drag a class and stereotype it «interface».  Do they look the same?  Is the caption on the properties dialog the same?  Is the Object_Type in the t_object row the same?  Do they have the same context menu?

EA has two ways of "representing" interfaces - as a Interface element and as a stereotyped Class element.  Conceptually, one could argue they are the same thing, but operationally within EA they are different.

When you create the "Interface" in the AI - which are you creating?  Check the properties dialog (and I'd also check the t_object row).  If you are creating an Interface Element, then (from the UML 2.2 Superstructure (formal) Specification): "As a classifier, an interface may be shown using a rectangle symbol with the keyword «interface» preceding the name."  So the «interface» term is a keyword NOT a stereotype.  It can't be removed (in EA).  If it's a stereotyped class, then you can remove the «interface» stereotype (using the [...] ellipsis button against the stereotype).  BUT, if you do, do you still have an interface (or just a class with a stereotype)?

[edit]Well, a bit of investigation shows that EA has implemented the keyword as a stereotype and so you CAN remove it.  To simulate the [...] ellipsis button with the AI, set the .StereotypeEx property to the same value as the .Stereotype property.  That should remove the «interface» stereotype[/edit]

Consistency, Consistency, Consistency! TM

HTH,
Paolo
« Last Edit: August 18, 2010, 10:39:51 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.&lt;Pogo, 1970&gt;
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #4 on: August 18, 2010, 01:06:01 pm »
Preach it, Brother Paolo!

EA's implementation of stereotypes is stuck somewhere between UML's original notion of a stereotype as little more than a string and the more developed notion of stereotypes as classifiers existing in a namespace. This inconsistency can lead to all sorts of madcap UML adventures, possibly contributing to accelerated hair loss.

For example, you might think that multiple stereotypes might be represented in the database as a delimited sequence of (possibly qualified) names, something EA does in a number of other places (e.g. object run state) [Codd's Bodkins!]. But you would be wrong. It seems that the original Stereotype field in EA database table t_object is a text field limited to 255 characters - wide enough for most cases, perhaps, but certainly not wide enough for all possible lists of applied stereotypes users might conjure up (it would be necessary to change the field to a Memo field [in Access / EAP files at least, BLOB or whatever in other RDBMS's], as in the case of object run state, to have 'unlimited' stereotype lists on a single field).

To get around this, EA uses an extra table - t_xref - to hold all stereotypes after the very first ALONG WITH the very first. For example, if I have an actor named "User", and then display User with rectangle notation, the stereotype «actor» appears. This isn't actually stored in the database as a stereotype; it simply means the element is a stick figure incognito. If I then add the stereotypes «bob», «carol», «ted», and «alice», I find the following has occurred:
  • The Actor "User" now has the string "bob" in the field t_object.Stereotype.
  • The other stereotypes, along with "bob," are in t_xref, represented (in a Memo field!) as follows:
Code: [Select]
@STEREO;Name=bob;GUID={E60E44BA-D7C4-4e06-8A1F-B97BBDAF637B};@ENDSTEREO;@STEREO;Name=carol;GUID={8F8BC8D5-9745-4770-B262-74C2853C18A4};@ENDSTEREO;@STEREO;Name=ted;GUID={D54F0850-F938-4532-9986-F68FC756FD7F};@ENDSTEREO;@STEREO;Name=alice;GUID={0EA90EBC-A048-443c-AD3D-DC027B0F209B};@ENDSTEREO;
If I now try to add the stereotypes «Bob», «BOB», and «bOb», there is NO CHANGE to the stereotype list - case is ignored for stereotypes. I can't change «bob» to «Bob» without deleting the original stereotype «bob» (which now appears in two places in the database) and adding a new one - «Bob». So I do just that, and my diagram now shows «actor,Bob». OK? But wait - if I then click on the stereotype drop down in the Element Properties dialog, it shows "bob". Close the dialog and the diagram reverts to «actor,bob». (It goes without saying that, in case-sensitive languages at least, bob <> Bob.)

Now, putting Codd and database normalization aside for the moment, none of this under-the-hood stuff would matter if EA hid it all neatly and consistently in the UI and in the AI. But if stereotypes are now really classifiers (which means their instances are now really objects), why not store them as such in a table akin to t_objectproperties? Why does StereotypeEx return a comma-separated list while TaggedValuesEx returns a collection? And why is schema backwards-compatibility a sacred cow?

Consider this your moment of Zen.
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


beginner

  • Guest
Re: stereotype  appears with a  strange format
« Reply #5 on: August 18, 2010, 08:53:43 pm »
Zen and the art of EA maintenance.

b.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #6 on: August 19, 2010, 08:27:07 am »
First, there is work to be done in the area of stereotype handling.  I have no problem admitting that.

Quote
EA has two ways of "representing" interfaces - as a Interface element and as a stereotyped Class element.  Conceptually, one could argue they are the same thing, but operationally within EA they are different.

Absolutely wrong.  EA has one way to represent an interface.  A stereotype of interface on a class does not change it into an interface, no matter how much it looks like one.

Also, don't confuse keywords (such as when displaying an actor in rectangle notation) with stereotypes UML defines them as different things.  Generally EA is doing this correctly.  (It appears it isn't for interfaces)

beginner

  • Guest
Re: stereotype  appears with a  strange format
« Reply #7 on: August 19, 2010, 06:32:17 pm »
Simon, you are right and wrong. EA offers an <<interface>> stereotype for classes (per default). Why? There is already an Interface element - which for unknown reasons comes along with also an <<interface>> stereotype. One can easily take that stereotype away and the Interface behaves the same way. Now: why is the Interface an <<interface>> Interface? This is pure EAUI. No wonder we users get confused.

b.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #8 on: August 20, 2010, 08:12:02 am »
As I said, EA is handling the keyword on an interface incorrectly.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: stereotype  appears with a  strange format
« Reply #9 on: August 20, 2010, 09:46:49 am »
Quote
As I said, EA is handling the keyword on an interface incorrectly.
So is a formal bug report necessary?

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