0

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!?

  • 1
    "Can I create a UML like a class diagram with module name instead of class name" - what is hindering you to do this? Does your UML drawing tool not allow this? So, why not? "Will it be valid" - well, who says what "valid" is? Your teachers? If that is your situation, you need to ask them, not strangers from the internet who definitely do not know your teachers' opinion on this. – Doc Brown Jun 13 at 11:31
  • @DocBrown What's hindering me is that UML is designed for OO. If I add it in a paper, I have to name what kind of diagram it is: this is the thing. What diagram should I draw and what will be its name? Class Diagram? (There is no class in it). – prime_hit Jun 13 at 13:43
  • Component diagrams, deployment diagrams, message sequence charts are still very useful when you have a non-OOP implementation. – BobDalgleish Jun 13 at 14:02
  • 2
    ... and do yourself a favor and don't use diagrams just because "they are available in UML". – Doc Brown Jun 13 at 14:37
  • 2
    UML isn't just about classes. – Robert Harvey Jun 13 at 14:40
1

UML is the Unified Modeling Language and it supports a range of paradigms for programming not just OO with its Class diagrams. Use whichever diagrams add value to your documentation or when discussing the implementation at a whiteboard or in review.

Structural diagrams

  • Class diagram - You can treat each module as a class for diagramming purposes.
  • Package diagram - Your module namespaces, hierarchy and interactions.
  • Object diagram - Can show structure of data or code.
  • Component diagram / Composite structure diagram - How your modules fit together
  • Deployment diagram - How the Components of the system are deployed on multiple servers

Behavioral UML diagrams

  • Activity diagram - The business process
  • Sequence diagram - Call hierarchy
  • Use case diagram - User interactions / Stories overview
  • State diagram - State of business objects if relevant
  • Communication diagram - None code interactions
  • Timing diagram - Real time systems interfaces

Not UML and a very old technique Jackson Structured Data diagrams are still one of the best ways to document a structure of files, both binary and text.

0

So you want to describe the functional implementation of the application with a diagram

You can use a sequence diagram to depict the functional flow among your modules. This is a bit more at a component level.

If you are talking about specific logic and a bit more detail go for a State diagram

Cheers..

0

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.

  • I appreciate your answer! I have done somewhat similar thing in my case, but still the diagram wasn't as descriptive as it could have been had I have used classes! I think there should have been more quality discussion on this so we can come up with better conventions. E.g., my Django application has views, utilities modules, models... etc, they all have their functions, but I still can't find a good way to connect them which describes the application better! Thanks for your answer though! – prime_hit Jun 27 at 16:23
  • I'm glad to hear that. Please check my answer as 'accepted' so that I will receive some credit points on this platform. – www.admiraalit.nl Jun 28 at 6:12
  • Prime_hit, you still didn't accept my answer, or any of the other answers. Do you have doubts? – www.admiraalit.nl Jul 21 at 11:57
  • I appreciate your answer, but I was looking for a way which is widely accepted, like we have for class diagrams etc. All the answers are right in a way... but I just don't feel that this question is closed yet. – prime_hit Jul 21 at 12:51
  • If you can refer me to a resource (book) which describes your way, I will be happy to accept your answer! – prime_hit Jul 21 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.