Pages

FP

Key Concepts/Terms of Functional Programming

The following concepts are major and important concepts of Functional Programming.
  • First-Class Functions.
  • Lazy Evaluation.
  • Higher-Order Functions.
  • Immutability(Non-Mutable Data).
  • Modularity.
  • No Side-effects.
  • Lazy Evaluation.
  • Recursive Function-Calls.

Imperative Programming ( IP )Core Concepts

  1. Sequence of Statements.
  2. Order of execution of Statements is very important.
  3. They contain state.
  4. They use both Immutable and Mutable Data.
  5. They can change state.
  6. They may have Side-effects.
  7. Stateful Programming Model.
  8. They directly change the state of Program.
  9. They represent state with Data Fields.


Functional Programming vs. Object-oriented Programming


Functional ProgrammingOOP
Uses Immutable data.Uses Mutable data.
Follows Declarative Programming Model.Follows Imperative Programming Model.
Focus is on:What you are doing”Focus is on “How you are doing”
Supports Parallel ProgrammingNot suitable for Parallel Programming
Its functions have no-side effectsIts methods can produce serious side effects.
Flow Control is done using function calls & function calls with recursionFlow control is done using loops and conditional statements.
It uses "Recursion" concept to iterate Collection Data.It uses "Loop" concept to iterate Collection Data. For example: For-each loop in Java
Execution order of statements is not so important.Execution order of statements is very important.
Supports both "Abstraction over Data" and "Abstraction over Behavior".Supports only "Abstraction over Data".