Now the problem is that I don't use object oriented programming (for reasons I will not specify here). I use instead procedural and data oriented programming. Under that paradigm, data is separated from code. Most UML models are based around object oriented programming, so they do not seem to fit my needs. I searched a bit if UML could be used with procedural languages, and it seems that in certain situation it's possible. Like for example, you could model a state machine if you need a state machine in your program.
Still, by looking at the various UML models, I cannot find what I need. From my perspective, I need to model 2 things: data and code. Data is easy, I could use relational database models, or class models (with only variables). But for code, I have not really found anything. Workflows are just too much detailed. So I came up with an idea to model the code structure without thinking too much of the details. My questions are:
Have you seen anything similar?
What do you think about it?
Am I missing anything?
----------------------------------------------------------------------
Procedural program modeling
The idea is that procedural programs are organized as a tree structure. Since you first start with the main() that get subdivided into smaller methods or tasks. The sorting of the method names could be done in execution order but it's not mandatory. The idea is to get a general view of the program (who call who) without having to write every loop and condition.
So far there is 2 special markers:
- A circle before the method indicated that a certain condition must be met to execute this method. (ex: "O - method_name" )
- Brackets could be used after the method name to indicates it's going to be repeated a certain number of times( ex: "| - repeat_me {5}" )
Here is an example for selection sort.
Code: Select all
main
| - select_sort
| | - inner_loop {n}
| | O - swap {n-1}
| - dispose_resources
After wards, it could be possible to group those methods into modules by drawing boxes around them. I want to make the model valid for plain C and Java language, so in C, methods will be put in the same .h/.c file, while in java it will be put into the same class as public static methods. The grouping of methods is based on thematic resemblance between methods, or if they need to have access to the same private methods. It's possible that private methods could be removed from the model for better clarity.