How to design an UML class diagramm with non objec

2019-07-16 00:53发布

问题:

I´m coding in ABAP and implemented a template method pattern. I like to draw some UML class diagramm for this. To do this in UML for the classes is no problem. But my class is implemented in a function module (SAP specific terms), its like an stand alone method which I use to make the implementation available to an Remote Procedure Call.

So what's the best possibility to get the non oo function module and the oo classes in one diagramm. Any ideas?

EDIT: Are you allowed to mix component and class diagrams?

回答1:

Treat the/each function as a class with one (static) method?



回答2:

We use a class with the sterotype <<function pool>> to represent - well - a function pool and methods with the stereotype <<function module>> to represent function modules. You can do the same thing with FORM subroutines, MODULEs, subroutine pools and the like. We also tend to use a stereotype-based coloring scheme so that interfaces are shaded green, the legacy procedural stuff like function pools is red and so on. Unfortunately, since there is no viable modeling tool with both system-to-model and model-to-system linkage, it’s rather a lot of work to use UML for ABAP development.



回答3:

Organize the functions in logical groups (e.g. their function groups). Create a utility class for each logical group and put the functions as static members of those utility classes.



回答4:

There is more to UML than class diagrams, based on the limited information provided I would make the SAP invoker element an external Actor on the system, use the system boundary to contain the OO aspects of the system documented within the Class diagram, use an activity diagram to document the full workflow.



回答5:

In Object (and Class) Orientation, everything is consider an object, even non objects !!!

Modules, namespaces, and libraries, are one of the things that U.M.L. creators seems to overlook.

Many designers represent global elements, enclosed in a file, namespace or module, representing the module as a single object or class.

I languages like Javascript, modules, are enclosed by a singleton object or global object.

This is a generic example of how non O.O. may be implemented.

......................................................................
..+----------------------------------------------------------------+..
..|                            <<module>>                          |..
..|                             Strings                            |..
..+----------------------------------------------------------------+..
..| [+] String[]: Letters                  <<constant>> <<global>> |..
..| [+] String[]: Digits                   <<constant>> <<global>> |..
..+----------------------------------------------------------------+..
..| [+] String: ToUppercase(String Value)  <<function>> <<global>> |..
..| [+] String: ToLowercase(String Value)  <<function>> <<global>> |..
..+----------------------------------------------------------------+..
......................................................................

Cheers.