ClassNotes – What exactly is Functional Programming?


Sharing some notes and insights gained as part of attending Martin Odersky’s Functional Programming course on coursera.org

1) Programming usually taught in colleges (atleast indian ones) is the  imperative style which is strongly based on von neumann’s design of what a computer should be like. It means programs in this style are instruction sequences. And a good number of the popular languages are written around this philosophy  “compute/execute instruction in processor,store data and results in memory and have a bus that serves as transportation between the two”

Functional programming is different from this. The approach of object oriented programming is orthogonal to both Functional or Imperative i.e. it is independent of the two and can be successfully combined with both the above discussed types of programming.

Martin Odersky says that imperative programming is limited by the “Von Neumann Bottleneck” which is that “One tends to visualize datastructures word-by-word” – I dint quite understand that in entirety – will update the post when i do so

 

Lets consider Mathematics. Every other topic in mathematics consists of laws that describe relationships between data and a set of operations that can be done on them. So Quote Martin ” If we want to implement  high-level concepts following their mathematical theories,then there’s no place for mutation”. So we want to be able to

  1. concentrate on defining theories for operators
  2. avoid mutations
  3. have powerful ways to abstarct and compose theories.

This is what functional programming  is all about. and this is the space that functional programming operates in.

Advertisements

About vatsalad

Hi, I'm Vatsala
This entry was posted in Functional Programming and tagged , , , . Bookmark the permalink.

One Response to ClassNotes – What exactly is Functional Programming?

  1. gold price says:

    The pure functional programming language Haskell implements them using monads , derived from category theory . Monads offer a way to abstract certain types of computational patterns, including (but not limited to) modeling of computations with mutable state (and other side effects such as I/O) in an imperative manner without losing purity. While existing monads may be easy to apply in a program, given appropriate templates and examples, many students find them difficult to understand conceptually, e.g., when asked to define new monads (which is sometimes needed for certain types of libraries).

Comments are closed.