A site devoted to discussing techniques that promote quality and ethical practices in software development.

Monday, November 12, 2012

Modelling Template Method Pattern in Modelio UML

According to this post, Modelio (ver 2.2.0) has a very narrow definition of a type of class that can implement an interface.

For example, according the Modelio, you cannot use its "Modeling Wizard > Implement interfaces properties" to implement the interface method in Foo, because it is an abstract class:

I have yet to meet a programming language that places such a restriction. In C#, I have frequently implements an interface with an abstract class by implementing the interface methods as abstract methods.

You can still use Modelio (ver 2.2.0) to model the application of say Template Method pattern which often done with an abstract class like this

But you have to do some extra work:
  1. If Foo is an abstract class, change it momentarily to non-Abstract class
  2. Then use "Modeling Wizard > Implement Interfaces properties" feature to implement in interface method(s) in Foo
  3. Change Foo back to abstract class
  4. Add additional abstract method, including changing Bar() to abstract if that is required.
  5. To implement the abstract Bar2Impl() in MyFoo class, Modelio does not have a convenient way like that in BoUML. However, you can use copy-and-paste the abstract method into the implementation class and changing it to non-Abstract method.
Do not use "Delete Interfaces Properties Implementations" feature in ver 2.2.0 as it has a bug that deletes all methods in that class.


pankaj said...

The UML Diagrams are neat. Which diagram tool do you use?


L. Mar said...


Blog Archive