UML – What to Use in UML for Included Module in Ruby?

class-diagramrubyuml

I like to create simple class diagrams for my projects. Most of the time I just use composition, inheritence and associations.
IBM's basic UML resource tells all about this.

However I'm using ruby so I got the option to define a module with some methods. I can just include this module in every class where I want to use these methods. This could be interpreted as an inheritence, however some of my classes are already child classes of an other class and I don't want to mix the meaning of a symbol used in my diagrams.

How should I display an included module in my class diagrams in UML?

Best Answer

UML does not have this kind of module concept, so it aso does not have a defined way to represent them in a diagram.

A few possibilities are:

  1. Don't show the module inclusion in your UML diagrams. UML does not require all details to be present in the diagrams and you can just decide that the fact that some of the methods are actually provided through Ruby's module mechanism is one such hidden detail.
  2. Model the Ruby modules as UML packages/classes and use a simple dependency to indicate the inclusion.
  3. Model the Ruby modules as a special kind of base class (you can mark them as special by using a stereotype for them, for example <<module>>)
Related Topic