Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML for C programming language [closed]

Tags:

c

uml

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.

like image 418
Andy Avatar asked Jan 11 '10 15:01

Andy


People also ask

Can UML be used for C?

Developers can use the UML file construct to model C applications without changing the format of their code. Modeling simplifies the development process, facilitates collaboration, and enables reuse.

Why UML is not a programming language?

UML is not a programming language, it is rather a visual language. We use UML diagrams to portray the behavior and structure of a system. UML helps software engineers, businessmen and system architects with modelling, design and analysis.

Is UML dependent on a programming language?

Short answer: no. Some UML modeling tools can generate Java, C++, and code in other programming languages. However, what it generates are usually interfaces and class relationships.

What is UML in C ++?

Object-Oriented Analysis, Design and Programming with UML UML stands for Unified Modeling Language. UML is different from the other common programming languages such as C++, Java, COBOL, etc.


1 Answers

I don't know of any existing resources that discuss using UML specifically for C. As others have mentioned, UML is language-agnostic.

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.

For modeling procedural-style C implementations, the following diagrams could be useful:

  • Class diagram:
    • Show C module APIs
    • Show C module relationships (mostly dependencies for non-OO)
    • Show structures and enumerations (using < < stereotype> >)
  • Package diagram: Show contents (modules) of libraries, and the dependency relationships between libraries
  • Activity diagram: Flowcharting non-trivial algorithms
  • Sequence/collaboration diagram: Show how events/messages between modules/entities/inputs/outputs occur in time
  • Statechart diagram: For state machines, of course!

Expanding on class diagrams, you can "abuse" them in the following way for procedural-style C:

  • Global extern functions -> public methods
  • Local static functions -> private methods
  • Global extern variables -> public members
  • Local static variables -> private members
  • Structs -> class with "struct" stereotype
  • #define constants -> class with "enumeration" stereotype

Experiment, and you'll find your own conventions for abusing UML.

like image 81
Emile Cormier Avatar answered Sep 20 '22 23:09

Emile Cormier