What are Functional Programming, Procedural Programming, Object Oriented Programming?

Day -6: 03/Sep/2018

rahul reddy
Sep 4, 2018 · 2 min read

In last few day I have heard about a concepts of functional programming and procedural programming. At first I taught both are same and C is a functional language. I couldn't be more wrong. So I thought I should learn more about them and the best way I know to learn is by writing. So I am writing this. First definitions:

Functional programming: Is a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.

Object-oriented programming: Is based on the concept of “objects”, which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.

Procedural programming: Is derived from structured programming, based upon the concept of the procedure call. Procedures, also known as routines, subroutines, or functions (not to be confused with mathematical functions, but similar to those used in functional programming), simply contain a series of computational steps to be carried out.

So what do the above definitions mean?

First in Procedural Programming you approach a software problem by creating a step by step instructions for the computer often in form of procedures or routines. Each procedure is a set of instructions for a computer to achieve a specific task.

Now Object-oriented programming, here we try to model a problem in terms of objects and their interactions. So what is an Object? An object is any thing with both state and behaviour. That is it has some fields and same methods which act on the fields.

Lastly Functional programming, here we approach the task at hand as a series of mathematical functions. The main difference between this approach and previous approaches is that a function should not change the data given to it in any way. Here we model the soluction as a series of functions from input to output.

I will go into more details about each of them in up coming blog posts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade