UML – Creating Diagrams for Non-Object Oriented Projects

djangoobject-orientedpythonuml

I am working on a python project and I didn't use classes but created different modules and added functions in them.

Now I need to draw a diagram to describe the project/application for a paper. I already have a context level diagram and activity diagram. But now I need to describe the functional implementation of the application with a diagram.

I have searched a lot but can't find a single (widely accepted) way!

It is a Django Project of an quiz application which is integrable with MOOCs like Canvas, Open edX... etc using LTI (Learning Tools Interoperability).

Remember that even though the code is not object oriented, but the modules are there which contains all the functions related to specific functionality in the application. For example, there is a file students.py which handles Students, there is another module teachers.py which manages teachers view.

Can I create a UML like a class diagram with module name instead of class name, and then put the functions in the modules? Will it be valid knowing that it is meant for a research paper!?

Best Answer

Can I create a UML like a class diagram with module name instead of class name, and then put the functions in the modules?

Yes, that is a valid way of using UML class diagrams. In UML terminology, the functions are called 'operations'. A class is usually represented by a rectangle with 3 compartments. The top compartment contains the class name, the middle compartment contains the attributes (not applicable in your case?) and the bottom compartment contains the operations.

If class A calls class B, then this is represented in UML by a dashed arrow from A to B, which is called a dependency relationship.

In your case, a class is in fact a module and it does not have more than one instance. You can indicate that in UML by writing a 1 in the top right corner of the class symbol. EDIT : This is not valid according to the latest version of UML. Instead you could define your own stereotype 《singleton》

Example: http://ptgmedia.pearsoncmg.com/images/ch16_9780131489066/elementLinks/16fig17.jpg

singleton

You can find the singleton pattern e.g. in "Applying UML and Patterns", Craig Larman. The use of dependencies among modules in a UML class diagram is described in e.g. "Describing Software Architecture with UML", C. Hofmeister.