Skip to content
BENIBIX Learn

OOP vs Functional Programming

Object-oriented code keeps data and actions together in objects. Those objects change over time. Functional code passes data through small functions. They make new values and change nothing.

Development🧭 Programming Paradigms

Object-Oriented Programming (OOP)

Code built from objects. Each object holds its own data and actions.

Object-oriented programming builds programs out of objects. Each object holds its own data and the actions that use it. You write a class once, like a plan for a dog, then make many dogs from it. Objects talk by calling each other's methods. Four big ideas sit at its core: hiding data, sharing code, swapping parts and keeping things simple. Java, C# and Python all use it.

Example
Jack's game has a Player class. Each of the four players is an object with its own name, score and move method.
Why it matters
Much of the code in big companies is built this way. Its words show up in every job interview.
Full entry
Development🧭 Programming Paradigms

Functional Programming

Code that hands back new values from small functions. Nothing changes in place.

Functional programming builds programs out of small functions. Each takes inputs and gives back outputs. A function in this style does not change anything outside itself. Data is not edited in place; you make a new copy with the change. Functions can be passed around like any other value. Haskell is built on it, and JavaScript and Python let you use it.

Example
Lucy turns a list of prices into prices with tax using map. The old list stays as it was, and a new list comes back.
Why it matters
Code that changes nothing outside itself is easier to test. It is also safer when many things run at once.
Full entry

In one line

Object-Oriented Programming (OOP)
Code built from objects. Each object holds its own data and actions.
Functional Programming
Code that hands back new values from small functions. Nothing changes in place.