What is Functional Programming

Page 1

What is Functional Programming While imperative code tells the machine, step-by-step, what it needs to do to solve the problem, functional programming instead seeks to describe the problem mathematically so that the machine can do the rest. What's the problem that we're trying to solve? The problem is the so called software crisis. We all know as developers that writing code is pretty difficult. We're writing huge programs and what we need to do is to reduce the time and the cost of development. We want to deliver software fast and we want to deliver correct software. The question is how can we make programs and code such that this code is fast. It doesn't take years to deliver but it takes doesn’t take months or as long as it needs to be. One way to do that, and we see this now in all modern programming languages, is to add features to our languages that allow programs to be written clearly concisely and at a high level of abstraction. And the techniques that we use in these modern languages are all based on functional programming. These techniques are all based on concepts from the lambda calculus. And Haskell is a functional language that is pure and therefore a really good vehicle to teach these concept. Functional languages therefore provide an elegant framework of abstraction. You can apply functional programming to any language even if your programming in assembly.

What is a functional programming language? The concepts vary, there is not clear definition. If we take a very purist approach a functional language is a language in which we program using mathematical functions. Functional, or declarative, programming is a very powerful programming method and is gaining popularity in the software industry. It is a style of programming in which expressions are more important than using statements. What we want to do is: we want to compose programs using expressions and these


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.