Functional Programming
Functional programming is a programming paradigm within the declarative programming approach which is based on mathematical functions. Functional programming was inspired by the lambda calculus which is a formal mathematical theory describing functions, their definitions, application and recursion. Examples of programming languages that are based on functional paradigm are Scheme, ML, Lisp, Haskel, and more recently F# to name a few. Declarative languages (functional and logic – e.g. Prolog) implement a different way of thinking about program design. In Imperative languages (e.g. C++, Java) the focus is on iteration and exact definition of how to achieve a task in a stepbystep manner involving mutation of state. In a pure functional language the focus of the programmer is on what to do and not so much on how the program should execute to achieve that. One way of thinking about this difference is to say that a functional programmer would order a product by describing what he wants a result while an imperative programmer would give the exact list of instructions involved in making the product instead. Functional programmers think on a higher level of abstraction and a program represents a strict logical definition of the problem to be solved. This approach results in higher productivity and less code. Purely functional programs don't rely on state (in fact state is immutable by default) and repetition is achieved only through recursion. This approach has many advantages because it produces more formal and well defined code with less bugs and is much easier to parallelize. Writing code that is easy to parallelize will become increasingly important in the coming years because of multicore processors and distributed computing systems. Concurrency issues are much harder to deal with in imperative languages because they rely heavily on the order of execution and mutable state. Major software corporations including Microsoft realized that fact and started introducing functional concepts to existing languages like C#. The latest addition to the CLR and the .NET Framework is a functionally inspired language F#, strongly influenced by ML family of functional languages (in particular OCaml). F# is in fact a multiparadigm programming language which means that although it can be used to write purely functional code it also supports imperative and Object Oriented constructs and therefore can be used effectively to implement a wide variety of software solutions including rich and fully functional windows applications and web applications. F# class libraries can be exposed to .NET and used from within any other .NET language as if they were written in C#, VB.NET or managed C++. There is a strong indication within the industry that functional and multiparadigm hybrid approaches to programming will become dominant within the next few years. Functional programs are very useful when dealing with complex data analysis and pattern matching. Recently there are multiple new companies being build that exploit the power of functional programming to develop consultancy solutions in the financial sector, logistics, and implementation of domain specific languages.