For modelling software implemented with the imperative or procedural programming paradigm we have Flowcharts, process diagrams, etc.

For object oriented we have UML class diagrams, object diagrams, state diagrams, etc.

Is there an UML diagram suitable designing software implemented with functional programming?

  • 4
    Data flow diagrams. Commented Jan 7, 2020 at 13:31
  • I guess you can still use flow charts, etc the cpu still excutes things one at a time* (except when it doesnt)
    – Ewan
    Commented Jan 7, 2020 at 14:45
  • 2
    @candied_orange: ... which are unfortunately missing in UML (which is the reason I have very seldom use for UML, since data flow diagrams is what I need most frequently).
    – Doc Brown
    Commented Jan 7, 2020 at 15:08
  • @candied_orange aren't dataflows provided by the object flows in UML activty diagrams ? Dataflows alone are not sufficient, since you can only model composition and decomposition, but nothing is foreseen for more complex functional flows like pattern matching.
    – Christophe
    Commented Jan 7, 2020 at 18:34
  • 1
    @Christophe: object flow looks heavily overengineered, and information flow oversimplified. Fortunately, there are tools like Draw.IO or StarUML which provide data flow diagrams in a satisfying way (as non-UML diagrams). But the "tool" I use most frequently for DFDs is the whiteboard at the wall behind my desk.
    – Doc Brown
    Commented Jan 7, 2020 at 19:57

1 Answer 1


In short

Yes and no!

Yes you can model it!

The UML activity diagram models control flow and object flow. Both are very practical to model individual functions, function composition, and function pipelines:

  • Functions would be represented by actions.
  • Composition can be shown with activitiy edges if needed using pins to show that object flows from one to the other (if you fear confusion between composition and sequencing).
  • Pattern matching in function definition can be represented with decision nodes in which you would use the patterns as guards for the outgoing branches.
  • Multiple input parameters could be represented with a join node, which has the advantage of underlining that the evaluation of the different parameters is not necessarily sequenced.

No, standard UML has no higher-order functions

In standard UML, there is no simple way to my knowledge, to represent higher order functions:

  • Higher-order functions are a core feature for functional programming.
  • But in UML an action cannot produce an action that is executed by another flow. It can not either accept actions as input to another action.
  • THis inner limitation comes from its roots, the petri nets, in which control flow was represented by tokens that navigate across a fixed network of nodes.

Perhaps some UML guru out there could find a workaround using invocation action, invoking the functor corresponding to an object of type function. But even if it would be possible, I don't think it would be easy to understand.

Note: that the same limitation occurs for non-UML models: dataflows (DFD) and also functional decomposition models (SADT) always consider activities as fixed. After all, how could you make the difference between an arrow that connects two functions and an arrow that delivers a new function?


  • to convince yourself of the feasibility, I invite you to look at some activity diagram examples, and -- despite these being designed with a procedural approach in mind -- try to imagine how you would implement them the functional way, you'd be surprised.

  • For the missing higher-order activities, I don't know what to advise. Perhaps make a customized UML profile to allow to visually represent the actions produced as a result of actions?

  • 1
    Hmm can uml handle anonymous inner classes? Commented Jan 7, 2020 at 22:04
  • 1
    @candied_orange that would deserve a question of its own ;-)
    – Christophe
    Commented Jan 7, 2020 at 22:38
  • I bring it up here because of how they give you the same power as a closure. Might let you model your first order functions. Commented Jan 7, 2020 at 23:23
  • @candied_orange interesting. An inner class would have to be represented as class in a package representing the outer class. Classes and properties are named elements. According to the specs: "Named elements MAY have a name", where MAY is to be understood as optional. So yes, anonymous inner class should be possible in principle, even if I have never seen any UML diagram using it. This being said, it's as with the higher order function: may be it can be represented somehow, but it will certainly not be easy to understand. This kind of construct is not part of UML's strengths...
    – Christophe
    Commented Jan 7, 2020 at 23:30
  • Yeah I haven't seen it done either so I've no idea how readable it would be. I just know it works because that's how Java 8 did it. Commented Jan 7, 2020 at 23:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.