comparison of functional and imperative languages

Differences between FP and OOP(IP)?

FUNCTIONAL PROGRAMMINGOOP
Does not exist StateExists State
Uses Immutable dataUses Mutable data
It follows Declarative Programming ModelIt follows Imperative Programming Model
Stateless Programming ModelStateful Programming Model
Main Fcous on: “What you are doing”Main focus on “How you are doing”
Good for Parallel (Concurrency) ProgrammingPoor for Parallel (Concurrency) Programming
Good for BigData processing and analysisNOT Good for BigData processing and analysis
Supports pure EncaspulationIt breaks Encaspulation concept
Functions with No-Side EffectsMethods with Side Effects
Functions are first-class citizensObjects are first-class citizens
Primary Manipulation Unit is “Function”Primary Manipulation Unit is Objects(Instances of Classes)
Flow Controls: Function calls, Function Calls with RecursionFlow Controls: Loops, 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
Order of execution is less importance.Order of execution is must and very important.
Supports both “Abstraction over Data” and “Abstraction over Behavior”.Supports only “Abstraction over Data”.
We use FP when we have few Things with more operations.We use OOP when we have few Operations with more Things. For example: Things are classes and Operations are Methods in Java.

No comments:

Post a Comment