Home > Software engineering >  Which UML diagram should be used for a Software overview which will be written in C for microcontrol
Which UML diagram should be used for a Software overview which will be written in C for microcontrol

Time:11-30

I was wondering on how to present a software overview using UML diagram. The code will be written in C for the microcontrollers. So, I can not use the CLASS diagram/ OBJECT diagram/ COMPOSITE STRUCTURE diagram I guess. Then,

  1. Which UML diagram should I use?

  2. Can Activity diagram be used for this? If so, is there any way to combine all the activities in a single diagram to have a view of the overall software?

  3. If UML diagram is not suitable, then which one is the right one for this purpose?

Thanks in advance.

CodePudding user response:

Ideally the program design should be tied up with your requirement specification, so that for each requirement there is a code module, and for that code module there is a test demonstrating how it lives up the requirement. It's kind of an utopia that one rarely manages to uphold in practice, but this kind of design is a good ambition anyway.

Then generally, it is not as important how you document the program design, as long as the overall design gets at all documented - this is surprisingly rare even in professional settings. But all the pedantic details of UML are really optional, use them where you find a case for them, don't use them just for the sake of it. I frequently use UML class diagrams to document code dependencies, as well as state charts which are useful for documenting application behavior. And so on - keep it broad without implementation-details.

The C equivalent of a class is typically a .h/.c pair with the same name, together forming a "module" or "ADT" or whatever you wish to call it.

You need to document all class A uses class B dependencies, as well as all class B is a class A dependencies (inheritance). Inheritance isn't very common in embedded systems, but implementing a HAL is a typical example where it is used. You have an abstract API on top of hardware-specific drivers.

Obviously you need to decide early on if such abstractions are justified - will the program eventually get ported to another MCU or do you count on the silicon vendor's "longlivety" assurance that the MCU will not go End of Life within the expected product life time? Looking at the completely broken silicon market as of today, I would assume that any microcontroller project needs to get ported plenty of times during its life time.

CodePudding user response:

To model an overview of the static structure of a large application written in C, I would recommend a package diagram. The packages in the diagram would represent the high-level directory structure of the application. Dependency arrows between these packages would indicate which subsystem makes use of which other subsystem(s).

For each top-level package, you could create a separate package diagram, showing the subdirecties and their dependencies.

  • Related