TomoLink
CompaniesAmazonSystem DesignImperative vs Functional vs Object-oriented Programming
System Design
Mediumsoftware-development

Imperative vs Functional vs Object-oriented Programming

30 minsProgramming ParadigmsSoftware Design
30 mins
1 sections
Programming Paradigms, Software Design

Overview

In software development, different programming paradigms offer unique ways to structure code. Three main paradigms are Imperative, Functional, and Object-oriented programming, each with distinct approaches to problem-solving.

Imperative Programming

  • Works by changing program state through a sequence of commands.
  • Uses control structures like loops and conditional statements for execution flow.
  • Emphasizes mutable data and explicit steps for task completion.
  • Examples: C, Python, and most procedural languages.

Functional Programming

  • Relies on pure functions, emphasizing computation without side effects.
  • Promotes immutability and the avoidance of mutable state.
  • Supports higher-order functions, recursion, and declarative programming.
  • Examples: Haskell, Lisp, Scala, and functional features in languages like JavaScript.

Object-oriented Programming

  • Focuses on modeling real-world entities as objects, containing data and methods.
  • Encourages concepts such as inheritance, encapsulation, and polymorphism.
  • Utilizes classes, objects, and interfaces to structure code.
  • Examples: Java, C++, Python, and Ruby.
Imperative vs Functional vs Object-oriented Programming [Medium] | Amazon System_design | TomoLink