Does it make sense to draw a UML class diagram in functional programming?

I was asked a school project to show the UML diagrams that I used - if I did - to implement the project. But the project I was working on was in C and was functionally programmed. Thus, I want to justify that using class diagrams when using an object-oriented language was pointless, but I am afraid that this is incorrect and could not confirm this hypothesis. It seems pointless to me, but I would like to know if this is so, because I may think that the code in the OOP method can help understand how it works.

Are there any advantages to the way you think and build a functional program when using class diagrams?

+4
source share
4 answers

Of course yes. The use of the class diagram is not as extensive as in the classical OOP, where very often using the class diagram only the automatic coding procedure is saved, but nevertheless it is very useful for:

  • Planning data structures (we still need to understand data and its relationships)
  • Creating a hierarchy of methods. (Grouping methods up to their data and tasks)
  • Linking methods and some special data. (Which method works with which data classes)
  • If the language supports OOP, you can use a class diagram that translates it into code.

, , , .

, , , - . . , . , .

+4

.

.

.

, . UML , .

file.c , , file.c .

+2

FP OO, FP OO. , FP .

However, UML can offer more than class diagrams. You will certainly benefit from status diagrams. Ultimately from timelines. And in a limited sense from sequence diagrams. The latter makes sense only if you can show "information markers" equivalent to the messages used in SD files.

Finally, a higher level image can be sketched using operation diagrams.

0
source

Source: https://habr.com/ru/post/1679610/


All Articles