Standalone Python functions in UML?

Roman Susi rnd at onego.ru
Tue Apr 4 13:05:19 EDT 2006


Ravi Teja wrote:
>>>Out of curiosity, how do I draw functions outside classes with UML? How
> 
> module could be drawn in this case?
> 
> As a utility class.

So, function could be a utility class method. If there are no better ways.

>>>More theoretical question is if I create classes on the fly, how UML can
> 
> reflect that?
> 
> "On the fly" usually means "at runtime". I guess you mean if you
> "change code" will my diagram stay in sync?. You will have to use round
> trip tools. I don't know any tool supports round trip for Python code.
> But if you just mean reverse engineering, lookup PyNSource, Boa
> Constructor, PyReverse among others

No. I do not need it. I just want to know if UML is capable of doing it.

> 
>>>(I know that Python code itself is best at communication design ideas,
> 
> but there are some people which prefer to talk UML.)
> 
> Actually no. Python is a good tool for "prototyping" which is not the
> same as "communicating design ideas". Diagrams are better for the later
> and do not need to be executable. At least from what I know, except
> Eiffel, no language makes that claim. UML is really the only contender
> currently for design notation.

Well, maybe SOL (Semantic Object Language) could also be quite
beneficial in some cases. At least, it depends with whom to communicate
design ideas and what level of formality to maintain.

Also, my argument that Python is quite good at communicating design
ideas is supported by the fact that Python developers do not use UML (or
other modelling tools/languages) as often as say Java programmers, nor
feel the need to. And probably Python is too dynamic for UML. That is
another reason rountrip tools aren't there.

-- 
Roman



More information about the Python-list mailing list