DEV Community

Cover image for Functional vs Object-Oriented Programming Paradigms
John Nweke
John Nweke

Posted on

Functional vs Object-Oriented Programming Paradigms

So, my CS Students keep asking me - what are the differences between Procedural and Object-oriented programming languages?

Makes sense that the info is all in one place now. OOP definitely built on the mistakes/faults of functional programming, and the inclusion of methods, encapsulation, and inheritance make OOP infinitely better.

Feature Procedural (Functional) Programming Object-Oriented Programming (OOP)
Focus Procedures or routines (functions) Objects (instances of classes)
Data and Functions Separate entities Bundled together in classes
Global Data Yes, often used Encourages encapsulation and local data
Modularity Emphasizes breaking down into procedures Emphasizes breaking down into objects and classes
Classes and Objects Not applicable Central to the paradigm, defining blueprints
Encapsulation Limited Key principle, bundling data and methods
Inheritance Not typically supported Supports the creation of derived classes
Polymorphism Not typically supported Supports polymorphism, method overloading, etc.
Example Languages C, Pascal, Fortran Java, C++, Python, Ruby, etc.
Abstraction Less emphasis Emphasizes abstraction for real-world modeling
Code Reusability Achieved through functions Achieved through inheritance, polymorphism, etc.
Complexity May be suitable for simpler projects Often preferred for larger, complex projects
Real-world Modeling May not closely mirror entities Designed to closely mirror real-world entities
Language Examples C, Pascal, Fortran Java, C++, Python, Ruby, etc.

What do you think? Were all the bases covered? Miss anything?


Photo by Max Duzij on Unsplash.

Top comments (3)

Collapse
 
ranjancse profile image
Ranjan Dailata

Consider providing some more examples of Functional Programming.

Also example about the pros and cons for the same.

Here are a few more functional programming languages.

  • Haskell
  • SML
  • Clojure
  • Scala
  • Erlang
  • Clean
  • F#
  • ML/OCaml
  • Lisp / Scheme
  • XSLT
  • SQL
  • Mathematica
Collapse
 
ranjancse profile image
Ranjan Dailata

Great post.

Please do explain about the Hybrid programming languages, for example - Rust, Python

Rust is a multi-paradigm programming language that is not strictly object-oriented or functional

Python is primarily an object-oriented programming (OOP) language, but it also supports functional programming

Collapse
 
insouciantqualms profile image
InsouciantQualms

Very nice. Though in my mind, procedural (aka imperative) is different from functional, which itself is different from object-oriented.