Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between functional, structured and procedural programming?

Tags:

I have read some articles on all subjects, but I don't quite get the differences.

like image 863
Demian Kasier Avatar asked Dec 09 '10 15:12

Demian Kasier


People also ask

What is the difference between functional and procedural programming?

Procedural programming uses a very detailed list of instructions to tell the computer what to do step by step. This approach uses iteration to repeat a series of steps as often as needed. Functional programming is an approach to problem solving that treats every computation as a mathematical function.

What is the difference between procedural and structured programming?

Procedural programming is based on procedure call which is locating specific tasks in procedures that are called by the main program code whenever a task needs to be completed. Structured programming is a type of programming that involves breaking the program into smaller modules of code.

Is C procedural or functional?

The different programming styles of these languages have formed the idea programming-paradigm: C is a typical represention of the procedural, LISP of the functional, C + + of the object-oriented and PROLOG of the logic-oriented paradigm.


1 Answers

Structured programming is an old term that I think would encompass functional, procedural, and much else. It basically means using explicit control-flow structures rather than jumping about directly from instruction to instruction.

Functional and procedural programming are both, in that sense, structured paradigms. Functional programming is also declarative programming -- the structure given to your code corresponds to its meaning -- a program is a function that changes the state of the world. Procedural programming is what you'd consider "typical" programming in any C language or its descendants, including OO languages such as Java and C++. A program is a series of instructions, to be executed serially, and invoking subprocedures along the way.

Or, as it has been famously described:

Functional programming is like describing your problem to a mathematician. Imperative programming is like giving instructions to an idiot.

    --- arcus, #scheme on Freenode 
like image 165
sclv Avatar answered Sep 27 '22 01:09

sclv