Book a Demo

Author Topic: How come derived classes do not inherit changes  (Read 4068 times)

Kring

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
How come derived classes do not inherit changes
« on: July 25, 2010, 08:32:04 pm »
Just starting out in Enterprise Architect, I made an abstract base class and 14 derived classes (specialization).  To my astonishment, when I change the name of an operation in the base class, the corresponding names do not change in the derived classes.  (Same if I add an operation etc, etc. - any change).  Does that mean I have to manually go through all the derived classes one by one and make the same change in all of them manually?
Is there an easier way?  Surely someone else must have the same experience?  What am I missing here?

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: How come derived classes do not inherit change
« Reply #1 on: July 25, 2010, 09:20:50 pm »
Quote
Does that mean I have to manually go through all the derived classes one by one and make the same change in all of them manually?
yup
Quote
Is there an easier way?  
nope
Quote
Surely someone else must have the same experience?  
yup
Quote
What am I missing here?
search "contract".

Seriously, there has been much said on this topic.  I, for one am (still) on the side of the status quo.  While I will agree that during exploratory (or "whiteboard") design, it would be handy to have ancestral genetics modifiable on demand (in fact, I really would like a tool that would get rid of my maternal grandfather's male pattern baldness), at the end of the day, when all things are considered, after considering the pros and cons, in the full balance of time, well...  better to leave genetics alone.

sorry
bruce

p.s. Just consider the economic benefits of a certifiable M$ genius reversing the order of the parameters in a stable, occasionally used .NET library!

Alternatively, consider this.  It is 8:49pm on Friday 13th, June 2013, you are the project manger of a fairly large revision of a fairly mission critical application that has absolutely no relationship to Java.  You are 25% over budget and the release is scheduled for this, the last weekend possible before the financial end of year.  There is a Senior Architect crucified on the wall of your office and a member of the corporate Human Resources department sitting in your visitor's chair, her face contorted in the final agonized paroxysms of death.  On the floor are the shredded remains of a graduate programmer whose last words, as far as you can recall, were "Oh, I thought I'd just change the naming conventions of the library to match the javabeans standards we were taught at school".  On the desk is a blood stained hammer, a coffee cup with some dregs emitting a faint odor of burnt almonds and a chainsaw with a very rusty and obviously blood stained blade.
Explain, in less than 600 words, to the nice policeman in front of you ...
« Last Edit: July 25, 2010, 09:58:27 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Kring

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How come derived classes do not inherit change
« Reply #2 on: July 26, 2010, 02:26:09 am »
Hahaha... thanks for the explanation!  I see the point, even.  Although I still think it would be nice to at least have some sort of option to do this.  Maybe I will change my mind when I am past the whiteboard stage...

Kring

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How come derived classes do not inherit change
« Reply #3 on: July 26, 2010, 03:23:47 pm »
Just tried the same thing in StarUML.  There, any changes in the a base object is automatically reflected in derived objects (seen when generated code)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How come derived classes do not inherit change
« Reply #4 on: July 26, 2010, 03:55:37 pm »
My point of view:

Automatically propagate changes to overridden features -> BAD
Having an option to somehow get changes propagated -> GOOD

Geert

Kring

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How come derived classes do not inherit change
« Reply #5 on: August 06, 2010, 02:51:38 pm »
I just learned that the Overrides and Implementations dialog box that you get automatically when creating a derived class can be brought up again from the menu: Element -> Advanced -> Overrides and Implementations.  It is not available by right-clicking the class.

So it is possible to manually delete old methods and then run Overrides and Implementations again.  That helps a little, although I still wish for a "rebuild class" or "re-derive class" function for derived classes that for methods would be equivalent to creating the class from scracth (much better than actually deleting and recreating the class since you will want to keep relationships to other classes etc.)

While I see the need to step cautiously in a mature project, many feel that a lot of the value of modeling lies exactly in the early stages.  I feel that a "re-derive" function would make EA more nimble and easy to use in the whiteboarding stage.  Which by the way, Sparx, is where people naturally tend to evaluate modeling tools...