Search code examples
functional-programmingprocedural-programmingstructured-programming

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


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


Solution

  • 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