问题描述
UML最常用的是使用C ++用于建模系统。在我的项目C是实现语言。我找了UML的策略,我想设计和再present过程中使用UML系统的不同方面这是适用于C.资源。
UML is most commonly used for modelling system by using C++. In my projects C is the implementation language. I am looking for resources on UML strategies which are applicable for C. I want to use UML during design and represent the different aspects of the system.
推荐答案
我不知道讨论使用UML专门为C.正如其他人所提到的任何现有的资源,UML是语言无关。
I don't know of any existing resources that discuss using UML specifically for C. As others have mentioned, UML is language-agnostic.
请与UML,你可以有一个问题域的实施模型,另一个。尽量不要在问题域在C而言模式,而是高层次的面向对象的。一旦你理解问题域充分的话,你就可以开始建模的实现。
Keep in mind that with UML, you can have a model for the problem domain, and another for the implementation. Try not to model the problem domain in terms of C, but rather as high-level OO. Once you understand the problem domain adequately enough, you can begin modeling an implementation.
有关建模过程式的C实现,下面的图可能是有用的:
For modeling procedural-style C implementations, the following diagrams could be useful:
- 类图:
- 显示C模块中的API
- 显示C模块中的关系(主要是依赖于非OO)
- 显示结构和枚举(使用<<刻板印象>>)
拓展类图,你可以滥用他们在过程-C风格的方式如下:
Expanding on class diagrams, you can "abuse" them in the following way for procedural-style C:
- 全球extern函数 - > public方法
- 本地静态函数 - >私有方法
- 全球extern变量 - > public成员
- 局部静态变量 - > private成员
- 结构体 - >带班结构的刻板印象
- 的#define常量 - >带班枚举的刻板印象
实验,你会发现自己的约定滥用UML。
Experiment, and you'll find your own conventions for abusing UML.
这篇关于UML对C语言编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!