Standalone Python functions in UML?

Rob Cowie cowie.rob at gmail.com
Tue Apr 4 06:16:17 EDT 2006


Roman Susi wrote:
> Hi!
>
> Out of curiosity, how do I draw functions outside classes with UML? How
> module could be drawn in this case?

I would say that within a class diagram, you can't. In other UML
diagrams (such as sequence interaction), the function is simply used as
if it were a method belonging to an object. If you need to make it
clear where this function is located within the code, use a note on the
diagram.

Remember, UML is not able to accurately capture all implementation
details of a system; It's not meant to.

>
> More theoretical question is if I create classes on the fly, how UML can
> reflect that?

Again, don't try to depict fine-grained implementation details. If the
dynamically generated class is important to the class diagram, include
it but don't include all of it's internals (methods etc.). Use a note
to exaplin how/when/why it is generated.

>
> (I know that Python code itself is best at communication design ideas,
> but there are some people which prefer to talk UML.)
>
> (Have not found anything relevant with google)
> 
> Thanks!
> 
> Regards,
> Roman Suzi

Rob C




More information about the Python-list mailing list