Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 598
Mike Hamer Avatar asked May 05 '09 16:05

Mike Hamer


People also ask

What are functional programming concepts?

Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions style. It is a declarative type of programming style. Its main focus is on “what to solve” in contrast to an imperative style where the main focus is “how to solve”.

What is functional programming example?

Functional programming is based on mathematical functions. Some of the popular functional programming languages include: Lisp, Python, Erlang, Haskell, Clojure, etc. Pure Functional Languages − These types of functional languages support only the functional paradigms. For example − Haskell.

What is OOP vs functional?

At its simplest, functional programming uses immutable data to tell the program exactly what to do. Object-oriented programming tells the program how to achieve results through objects altering the program's state. Both paradigms can be used to create elegant code.

Is C# functional programming?

C# developers are also used to other functional techniques, especially LINQ with its heavy usage of lambda expressions, and extension methods. C# supports various functional aspects so that it may be worth to take a glance at the previously introduced core fundamentals of functional programming from its perspective.


1 Answers

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.

like image 61
S.Lott Avatar answered Oct 30 '22 20:10

S.Lott