Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML how to represent a class concern/module/extension

Tags:

ruby

swift

uml

I am talking about concern/module/extensions as they exist in Ruby and Swift for example.

A Ruby module is something that a class can include (= add the module functions as its own instance methods) or extend (add the module functions as its own class methods).

A swift extension is also an add-on for class, typically when you want to add a functionality you would first define the prototype, then implement it in an extension.

(please correct me if I'm wrong)

How would you represent such a Ruby module/Swift extension in UML, and its link to the class it is included in/it extends ?

like image 296
Cyril Duchon-Doris Avatar asked Sep 02 '25 09:09

Cyril Duchon-Doris


1 Answers

I also don't know a standard for this, but would model it like this:

enter image description here

A Realize relation with an <<import>> stereotype. Maybe the Realize is too strong in the context and a simple Dependency but still with that stereotype would be better.

Not everything is available natively in UML. But like in any language, if you don't have a single word for a thing you can make constructs that describe the thing. You are rather free in choosing your vocabulary. Only you should be consistent in the domain where you use such a paraphrase.

like image 97
qwerty_so Avatar answered Sep 05 '25 01:09

qwerty_so