Strictly functional languages account for perhaps fewer than one percent of all programs in use. The paradigm is at least as old as computer languages and a common saying among computer scientists is that all programming languages as they mature come closer to Lisp, the first functional programming language. By this, it is usually meant that first class functions are supported.
Procedural programming languages tell the machine what to do, following algorithms. You program from the perspective of the machine, the art in being how best to model the steps that the machine makes. Most of the familiar languages and techniques in use are procedural, including Java and the various flavors of C. Object oriented methods are in this camp, indeed many software engineering techniques.
The functional paradigm differs in that it sets up a world with behaviors as functions. You don't tell the computer what to do; you build a world where things turn out happily. Its like rearing a child (or building a team). You can build one that does what you tell it to or one that understands what causes what and how to navigate it.
Functional programming at this level is very hard to wrap your head around if you are familiar with the other way; it is far harder to model a world than to describe a task.
Functional programming the way we are using it allows a few advantages. The code has a very useful mathematical framework associated with it, category theory (discussed elsewhere). That means that you inherit for free, without any additional coding, a whole complex of methods to analyze and manipulate your programs. Many of these were developed for proving code correctness and other trusted qualities. In fact, a rather famous theorem says that any suitable mathematics can be mapped to functional code and vice versa.
Functional programming allows mixing of code and data. Code can be considered as data and modified by other parts of the program.blog comments powered by Disqus