Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can UML be used to model a Functional program? [closed]

More specifically, how do you model a functional program, or one developed using the Functional Style (without classes) using a diagram, and not textual representation.

like image 239
WeNeedAnswers Avatar asked Mar 16 '10 20:03

WeNeedAnswers


People also ask

Which UML diagrams Cannot be used?

There is no UML diagram such as interface diagram.

What can UML be used for?

UML is used to create static structure diagrams based on a variety of engineering practices that have proven to be successful in the creation of complex systems. The published standards are almost 800 pages long. Historically, UML has been used to model software systems, but it's not limited to software developers.

What can you model with UML?

UML models contain model elements, such as actors, use cases, classes, and packages, and one or more diagrams that show a specific perspective of a system. A model can also contain other, more detailed models. You create and manage models using modeling projects in the Project Explorer view.

What type of UML diagram is best for showing a functional overview?

Use Case Diagram As the most known diagram type of the behavioral UML types, Use case diagrams give a graphic overview of the actors involved in a system, different functions needed by those actors and how these different functions interact.


4 Answers

Functional programmers generally don't have a lot of use for diagrams. Many functional programmers (but not all) find that writing down types is a good way to encapsulate the design relationships that OO programmers put into UML diagrams.

Because mutable state is rare in functional programs, there are no mutable "objects", so it is not usually useful or necessary to diagram relationships among them. And while one function might call another, this property is usually not important to the overall design of a system but only to the implementation of the function doing the calling.

If I were feeling a strong need to diagram a functional program I might use a concept map in which types or functions play the role of concepts.

like image 171
Norman Ramsey Avatar answered Oct 12 '22 10:10

Norman Ramsey


UML isn't only class diagrams.

Most of the other diagram types (Use case diagrams, activity diagrams, sequence diagrams...) are perfectly applicable for a purely functional programming style. Even class diagrams could still be useful, if you simply don't use attributes and associations and interpret "class" as "collection of related functions".

like image 30
Michael Borgwardt Avatar answered Oct 12 '22 11:10

Michael Borgwardt


Functional programmers have their own version of UML, it is called Category Theory.

(There is a certain truth to this, but it is meant to be read with a touch of humour).

like image 18
dtw Avatar answered Oct 12 '22 10:10

dtw


UML is a compendium of different types of modeling. If you are talking about the Object Diagram (Class Diagram), well you are not going to find anything that fits your desired use. But if you are talking about an Interaction Diagram (Activity Diagram) or Requirements Diagram (Use Case Diagram), of course they will help you and are part of the UML base.

like image 13
jpabluz Avatar answered Oct 12 '22 11:10

jpabluz