2

I am trying to work on a Python project thant is not documented.

I did a reverse engineering to get the Class diagram 2 times in windows environment : with sparx EA and with visual paradigm.

But in both cases I got a class diagram with classes without relationships (even if i did configure the process to generate them). is it possible or is there a problem ?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
quvine
  • 21
  • 3

2 Answers2

2

Almost all tools (for myself I have expertise in EA and backdated in RSA) have difficulties showing relations between classes. Basically they RE the structure (files/packages) and the operations/properties of the single classes. In some cases you also will get relations but as said: this is limited.

Anyhow, if you are going to understand the code it's good practice to complete/correct the missing relations between the classes and thereby adding comments as well.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • yes understandin and scanning the code is the solution i thought about too, it s just that i m not used to python and since i don t have much time i as lookin for another faster solution. like a tool which is dedicated for that or something.. – quvine Aug 28 '15 at 12:29
1

It's possible, certainly. There may not be anything in the code that the reverse-engineering process recognizes as a UML relationship. Precisely what that would be depends on the language and tool, since there are no standardized UML profiles for any implementation languages.

UML is fundamentally object-oriented, but in Python, object-orientation is optional. If the code doesn't use classes, there isn't much for UML to work with. Python's dynamic typing also makes it tricky to deduce the types of variables from the source code, which means it's hard for the UML tool to identify associations.

In EA, there are some options you can play with under Tools -- Options -- Source Code Engineering. On that page there's "Create dependencies for operation returns and parameter types," which I believe is off by default. But since EA treats all Python types as var I don't think this would have much of an effect.

There are further options per language, but I don't think there's anything in the Python section that affects relationships.

Uffe
  • 10,396
  • 1
  • 33
  • 40
  • yest, that is exactly what i thought about.uml is OOP and so is python and when i scam the classes there is defintly relationships between certain ones.but since i m not used to python and i don t have enough time to learn it, i cannot scan the code myself and try to identify them. – quvine Aug 28 '15 at 12:23