Author Topic: Bug when copying package  (Read 336 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Bug when copying package
« on: October 19, 2017, 12:31:55 am »
When copying a package you can get nasty side effect if other classes are depending on classes in the copied package.
E.g. classes in other packages that have a generalization to classes being copied now have two generalizations. One to the original, and one to the copied class.

Steps to Reproduce:
- create packageA with classA
- create packageB with classB
- create generalization from classB to classA
- copy packageA (full structure for duplication)
- paste packageA resulting in a copy of packageA
- notice that classB now has two generalizations. One to the original ClassA, and one to the copied ClassA.

Reported

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5848
  • Karma: +71/-75
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Bug when copying package
« Reply #1 on: October 19, 2017, 10:44:48 am »
When copying a package you can get nasty side effect if other classes are depending on classes in the copied package.
E.g. classes in other packages that have a generalization to classes being copied now have two generalizations. One to the original, and one to the copied class.

[SNIP]

Reported

Geert
Well, from an absolute conceptual point of view, that may not be a bug.  I could be argued that it's up to the modeller to determine which of the two the dependent element should generalize.

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bug when copying package
« Reply #2 on: October 19, 2017, 02:33:13 pm »
I don't agree with that Paolo.

On the conceptual level making a copy of package A should never ever change elements in package B.
Adding a generalization to elements in package B is definitely changing them.

On the practical level this bug has the potential to really mess up you model. Nobody is expecting or wanting that behavior, and nobody will know all the elements that have a dependency to elements in the copied class.

Workaround to fix it:

- Export the copy of package A to xmi
- Delete the copy of package A
- Import the xmi into a new empty model
- Export the copy of package A back to xmi
- Import the new xmi back into the model

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5848
  • Karma: +71/-75
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Bug when copying package
« Reply #3 on: October 19, 2017, 05:40:06 pm »
Geert,

It wasn't clear from the original post if it was JUST Generalization that has the problem.  If so, then it's a bug (as probably is demonstrated by your workaround).  ;D

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bug when copying package
« Reply #4 on: October 19, 2017, 05:51:41 pm »
Geert,

It wasn't clear from the original post if it was JUST Generalization that has the problem.  If so, then it's a bug (as probably is demonstrated by your workaround).  ;D

Paolo
It isn't just Generalization. It happens with dependencies too, and I suppose with most, if not all, relations.
But anyhow, it is still a bug if copying a package changes elements in entirely different packages all over the model. (adding a relation to an element should be considered changing it as much as adding an attribute)
I don't see any way you could justify that, not even conceptually.

Geert


Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6181
  • Karma: +45/-5
    • View Profile
Re: Bug when copying package
« Reply #5 on: October 20, 2017, 08:03:52 am »
adding a relation to an element should be considered changing it as much as adding an attribute
Depends on the direction.
Simon

support@sparxsystems.com

Glassboy

  • EA User
  • **
  • Posts: 880
  • Karma: +52/-54
    • View Profile
Re: Bug when copying package
« Reply #6 on: October 20, 2017, 08:12:06 am »
adding a relation to an element should be considered changing it as much as adding an attribute
Depends on the direction.
Depends on how the tool treats the relationship :-)  If it does something irrespective of the direction then the direction is absolutely irrelevant.

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6181
  • Karma: +45/-5
    • View Profile
Re: Bug when copying package
« Reply #7 on: October 20, 2017, 08:39:59 am »
I could add the word "conceptually". Of course not all relationships have direction conceptually (eg. Association has two or more ends where each end can be owned by the association or the classifier) in which case you would need to use a different method to determine if adding it is changing each end. Some relationships aren't technically changing either end. (eg. Dependency is technically not changing either end, it's intentionally too abstract to have any concrete meaning)
Simon

support@sparxsystems.com

Glassboy

  • EA User
  • **
  • Posts: 880
  • Karma: +52/-54
    • View Profile
Re: Bug when copying package
« Reply #8 on: October 20, 2017, 08:52:25 am »
I could add the word "conceptually". Of course not all relationships have direction conceptually (eg. Association has two or more ends where each end can be owned by the association or the classifier) in which case you would need to use a different method to determine if adding it is changing each end. Some relationships aren't technically changing either end. (eg. Dependency is technically not changing either end, it's intentionally too abstract to have any concrete meaning)

Yes.  The point being we don't use your software conceptually.  We [mis]use it to do all sorts of horrible analysis of all sorts of horrible business problems.

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6181
  • Karma: +45/-5
    • View Profile
Re: Bug when copying package
« Reply #9 on: October 20, 2017, 09:05:59 am »
I know, my life would be so much simpler if you didn't.

I can't complain though I [mis|ab]use it all the time too. The flexibility that it offers to do crazy things is one of its strengths.
Simon

support@sparxsystems.com

Glassboy

  • EA User
  • **
  • Posts: 880
  • Karma: +52/-54
    • View Profile
Re: Bug when copying package
« Reply #10 on: October 20, 2017, 09:17:09 am »
I know, my life would be so much simpler if you didn't.

If it's any consultation I spend a significant amount of my week harassing our product teams too about making features work for customers :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5848
  • Karma: +71/-75
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Bug when copying package
« Reply #11 on: October 20, 2017, 10:49:47 am »
I know, my life would be so much simpler if you didn't.

If it's any consultation I spend a significant amount of my week harassing our product teams too about making features work for customers :-)
(my emphasis)  Oh, so you're an "insultant" - not providing any consolation!   ;D

It's Friday!   YAY!!!!

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bug when copying package
« Reply #12 on: October 20, 2017, 02:59:48 pm »
adding a relation to an element should be considered changing it as much as adding an attribute
Depends on the direction.
With adding relation to element I mean adding a relation owned by the element.

When copying something my expectation is that everything it owns is copied as well, but I don't expect or want it to copy anything it doesn't own.
And that is exactly what EA is doing. It is duplicating relations not owned by the element I'm copying.
That seems like a clear and simple bug to me.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bug when copying package
« Reply #13 on: October 23, 2017, 05:08:36 pm »
Bug has been confirmed by Sparx and will be fixed.

Geert

Graham_Moir

  • EA User
  • **
  • Posts: 676
  • Karma: +4/-4
    • View Profile
Re: Bug when copying package
« Reply #14 on: October 23, 2017, 09:02:48 pm »
Geert - do you know if this issue exists in the time-aware modelling/cloning functions as well?