Inheritance Rearrangement

December 16, 2022

Rearranging the inheritance between capsules is a simple thing to do in a class diagram, but it can have a big impact on the model. If a subcapsule gets a new super capsule that do not inherit from the previous super capsule, several references in the subcapsule state machine may become affected. For example, the subcapsule state machine may contain redefined states that reference inherited states of the old super capsule's state machine.

To avoid breaking affected references, Model RealTime applies a general strategy of absorbing (i.e. copying) referenced elements that no longer will be accessible after the inheritance rearrangement. The copies are placed in the subcapsule and references are updated to instead refer to these copies.

In Model RealTime 11.2 2022.48 several enhancements were implemented in the area of inheritance rearrangement. The Inheritance Rearrangement dialog is now significantly improved and can show the list of references that will be affected by an inheritance rearrangement. You can choose for each reference how to handle it, and it's possible to navigate to show the referencing element in the Diagram Editor, Project Explorer or Properties view.

Note that the Inheritance Rearrangement dialog shown above will only appear if at least one reference in the subcapsule cannot be bound to its current target element after the refactoring. In case all target elements are still accessible (because the new super capsule already inherits from the old super capsule), then the simpler version of the dialog appears instead and the inheritance rearrangement becomes trivial to perform.

This is an important improvement since it enables the common scenario of adding or removing capsules from an existing inheritance hierarchy with minimal effort.

For more information about inheritance rearrangement see this article.