Search code examples
pycharmuml

Generate UML for Python classes in Pycharm


I am trying to build a UML diagram for my Python classes in Pycharm(Professional Edition). I have two questions.

  1. Normally according to UML standards the top-most is the class and then the attributes and then the methods but in my case when I generate the UML the position of methods and the attributes are interchanged. I tried understanding the UML standards but it always says attributes and then the methods. Is my UML diagram still considered to be correct or Do I need to alter it?
  2. Pycharm UML doesn't add public, protected or private visibilities and it is also known that in Python all the methods and attributes are mostly by default public. UML without mentioning visibilities of methods or attributes is still a good practice?

Unfortunately not able to add the diagram.


Solution

  • Ad 1) Basically it's not per UML's definition. But unbasically you can leave it as it is. Everyone would likely understand alone based on the parentheses. Diagrams are for humans. If they don't get THAT they should be doing some other business.

    Ad 2) Showing visibility is optional. And in case of Python it would not make sense anyway since anything is public and you only have a naming convention.