英文:
UML component diagram for Python code: How to illustrate difference between classes and modules?
问题
Sure, here's the translated content without code parts:
我需要为我的代码/科学论文绘制一个UML组件图。
我的Python项目由一些不同的文件(模块)和一些类组成。
如何在UML组件图中表示这些?是否需要根据“组件”的“类型”使用不同的连接器?
假设有以下“组件”:
-
服务(类)
-
PdfCreator(类)
-
calc_utils(模块)
-
与2. 和3. 互动。
英文:
I need to draw an UML component diagram for my code / a scientific paper.
My Python project consists of a few different files (modules) and also some classes.
How do you illustrate this in a UML component diagram? Do i have to use different connectors depending on the "types" of the "components"?
Let's say there are the following 'components':
- Service (class)
- PdfCreator (class)
- calc_utils (module)
1 . interacts with 2. and 3.
答案1
得分: 1
基本上,Python 类对应于 UML 类。Python 模块只是被视为包含一组类的 UML 组件。您可以自由展示包含的类和/或显示与该组件的接口。对于 Python,后者可能不太适用。您可以使用类之间的依赖关系来表示它需要一个模块。在这里,您可以特别利用 "use" 关系。
英文:
Basically a Python class corresponds to a UML class. A Python module can just be seen as UML component containg a set of classes. You are free to show the contained classes and/or to show interfaces with the component. Probably for Python the latter is less appropriate. You can use dependency from a class to show that it needs a module. Here you can especially utilitze «use» relations.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论