Sunday, July 4, 2010

Functional Programming Vs Procedural Programming

Functional Programming

Functional programming should not be confused with procedural programming. Neither is it like object oriented programming. It is something different. Not radically so, since the concepts that we will be exploring are familiar programming concepts, just expressed in a different way. The philosophy behind how these concepts are applied to solving problems is also a little different.

Functional programming is all about expressions. In fact another way to describe Functional Programming might be to term it expression oriented programming since in Functional Programming everything reduces to an expression. You should recall that an expression is a collection of operations and variables that results in a single value. Thus x == 8 is a Boolean expression. 3 + (9-Y) is an arithmetic expression. And "Hello".uppercase() is a string expression. The latter is also a function call (Or more strictly a method call) on the string object "Hello" and, as we shall see, functions are very important in Functional Programming.

Programming language :- Python

Procedural Programming

A list of instructions telling a computer, step-by-step, what to do, usually having a linear order of execution from the first statement to the second and so forth with occasional loops and branches.

A procedural program is composed of one or more units or modules--either user coded or provided in a code library; each module is composed of one or more procedures, also called a function, routine, subroutine, or method, depending on programming language.

Programming language :- C

No comments: