Book a Demo

Author Topic: Template Package Item selected "by luck"  (Read 4648 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Template Package Item selected "by luck"
« on: May 03, 2010, 08:41:13 pm »

In Template Package Item Rendering outcome I expose the bug that you won't get consistent item rendering in different target diagrams for items defined in a template package.

This bug, essentially, makes that problem moot since (it appears) that the diagram to be used as the source for the new item in the target diagram is defined almost "by accident" - and so your new item may look NOTHING like you expect it to...

OK, let's start by noting that in EA any item (pretty much) can be placed on any diagram type.  For any model, of more than say two items, it is extremely likely that any given item will be placed on more than one diagram.  Let's also assert that for most (if not all) of those diagrams, the item will have the same rendering but on some may have other renderings.

EA accommodates this usage by the concept of the local diagram rendering (set via the Format Tool (View|Toolbars>Format Tool) and the concept of a default rendering (set via Appearance>Default Appearance... [F4]).  So far so good.

EA also has the notion of a Template package where the user can set the initial values (Note how I haven't set default - although the Help implies that) for new (unstereotyped) items:
if you drop an unstereotyped element - a Class, for example - onto a diagram, Enterprise Architect searches the Templates package for a Class diagram that defines an unstereotyped Class, and applies that definition to the new Class.

So you see how the Help EXPLICITLY says that for a Class it searches for a Class diagram?  Well that doesn't appear to be the case!  What EA does (it appears from the limited testing I - and apparently NOT Sparx have done) is locate the item type with the lowest object ID within the Template package! In fact the template item doesn't have to be in any package at all!  Currently, I have (as a result of this testing, NO diagrams in my template package and and the new items are still being created according to some of the items within the package.  NOTE: Because there is NO local override, only the default appearance attributes are used.  However, IF the item with the lowest Object_ID is in ANY diagram, the local settings from that diagram are used!  Confused?  You should be!

So if you have the same type of item defined more than once (why would you? - see below), it will take the item with the lowest Object_ID.

Obviously there is are two defects here - the first is either in the behaviour or in the help definition, the second is in Sparx's design,  testing and development process!

Back to why define the item type more than once?  As I mentioned above, you can place any (pretty much) item type on any diagram type. Having found the bug regarding the the local versus default rendering identified above, I thought I'd investigate if EA took the source diagram from the target diagram type.  I created the same class in an activity diagram but found that the resultant rendering on the activity diagram was the one from the (original) Class diagram.  I then removed the class from the class diagram, and the next new class took its rendering from the rendering in the Activity diagram!

It occurs to me that if you followed a logical algorithm for the ultimate rendering of an item from the template package you might create something like this:
Check the type of the target diagram, if there is an item of the same type on the same type of diagram in the Template package, use its rendering.   Otherwise, if there is only one rendering of the same type of item on one diagram in the template package use that.  Finally, if there is an element of the same type but not on any diagram (or in more than one diagram, none of which are the target diagram type) in the template package, use the Default rendering for the element (as defined for that element), otherwise, use the EA default.

NOTE: Because this is a Template package, there should only be one instance of each type of element and each type of diagram in the package (and EA should validate this).  You'll note that if we take the actual rendering in the diagram, as the default rendering for the new element, the same browser element can have different renderings in different diagrams!

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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Template Package Item selected "by luck"
« Reply #1 on: May 03, 2010, 08:43:14 pm »
{Part 2}

Now, I admit, I can't readily find any real practical use for defining different renderings for the same type of element but different initial diagram types, but the algorithm is consistent and if you have only one instance of the item type, it behaves appropriately.

Reported,
Paolo
If you want to vote for a fix for this, submit a Registered Bug Report or Bug Report
with the same name, leaving a note here to say you've done it
 - so we users have an indication of the level of support.

 Please indicate in the report whether you believe EA should enforce only one instance of each element type and diagram type in the Template package.
 Please also indicate whether you think EA should use the target diagram type in selecting the rendering to use.

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

beginner

  • Guest
Re: Template Package Item selected "by luck"
« Reply #2 on: May 03, 2010, 11:20:08 pm »
I wonder how much Sparx is paying you for those beta test.

I will not vote pro or con since I never used the Templates (except for a very short time in very early days where I decided for myself that it's simply rubbish - God knows I was right there).

I just stumbled over a set of bugs (they seem to crowd in EA) in the worsened Search dialog (Filter TagValues crashes EA, et al.). I'm really sick of sending bug reports. Looking at the current bunch you sent in, I wonder whether 8.0 is really out of a beta state.

Very frustrating.

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Template Package Item selected "by luck"
« Reply #3 on: May 03, 2010, 11:33:37 pm »
beginnner,

The template package is something entirely different from the RTF templates.
It is a designated package that holds the prototypes for your elements and diagrams.

Geert

beginner

  • Guest
Re: Template Package Item selected "by luck"
« Reply #4 on: May 03, 2010, 11:43:29 pm »
I know that, Geert. You might have missed that I do not use RTF either. I didn't mention RTF here, did I?

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Template Package Item selected "by luck"
« Reply #5 on: May 03, 2010, 11:51:40 pm »
So you mean both are rubbish?  ;)

Geert

beginner

  • Guest
Re: Template Package Item selected "by luck"
« Reply #6 on: May 04, 2010, 12:33:29 am »
Not completely. For the second just RTF is rubbish. Means that RTF templates do not make much sense for me (what are these at all???).

b.