R – Functional programming – standard symbols, diagrams, etc


I have a problem, which I believe to be best solved through a functional style of programming.

Coming from a very imperative background, I am used to program design involving class diagrams/descriptions, communication diagrams, state diagrams etc. These diagrams however, all imply, or are used to describe, the state of a system and the various side effects that actions have on the system.

Are there any standardised set of diagrams or mathematical symbols used in the design of functional programs, or are such programs best designed in short functional-pseudo code (given that functions will be much shorter than imperative counterparts).

Thanks, Mike

Best Solution

There's a secret trick to functional programming.

  1. It's largely stateless, so the traditional imperative diagrams don't matter.

  2. Most of ordinary, garden-variety math notation is also stateless.

Functional design is more like algebra than anything else. You're going to define functions, and show that the composition of those functions produces the desired result.

Diagrams aren't as necessary because functional programming is somewhat simpler than procedural programming. It's more like conventional mathematical notation. Use mathematical techniques to show that your various functions do the right things.