4

I need to create a diagram using UML or SysML notation. I've got modules, that consists of functions. Some functions are used only “inside” the module, others are used by other modules.

Example:

MODULE 1 has two functions: func1 and func2. func2 uses func1:

int func1 (int p1, int p2)
{
   d=func1();
   return noerr;
}

int func2 (int p3, int p4)
{
    if (p4>0 || func1(p1,p2))
    {
        // warning
    }
    else
    {
        return noerr;
    }
}

MODULE 2 has one function, func3. It uses func1 from MODULE 1:

int func3 (int p5, int p6)
{
    if (p5<0 || func1(p1,p2))
    {
        // warning
    }
    else
    {
        return noerr;
    }
}

I need to show graphically interaction between func1 and func2 inside MODULE 1 and interaction between MODULE 1 and MODULE 2 with use of func1. I'll appreciate any help and samples.

Christophe
  • 68,716
  • 7
  • 72
  • 138
Omnimbuss
  • 51
  • 2

1 Answers1

6

In UML, I would regard the modules as classes and the functions as operations of these classes, as in the following class diagram:

classd

The dependencies at the function level and the interaction between the modules can be depicted using sequence diagrams as follows:

seq1

seq2

Christophe
  • 68,716
  • 7
  • 72
  • 138
www.admiraalit.nl
  • 5,768
  • 1
  • 17
  • 32
  • Thank You so much! I thought about that too. But the problem is that those diagrams shows only interactions for "control" flows and does not represent "data" flows. Is it possible to show also data flows using this views without creating additional diags? – Omnimbuss Sep 22 '16 at 08:39
  • You may insert the parameter names and values in between the brackets and you may display reply messages (dashed arrows from callee to caller) with the data returned as text near those arrows. See Figure 2 of http://www.ibm.com/developerworks/rational/library/3101.html#N100A4 – www.admiraalit.nl Sep 22 '16 at 08:58
  • Depends on what you define as "data". The messages take parameters (above they are just empty brackets). These parameters can well be seen as data. (Hehe. Cross-posting ;-) – qwerty_so Sep 22 '16 at 08:59