The Non-Programmers guide: Functional Programming vs Object Orientated Programming


Technology, Engineering

Functional Programming is the technique of programming stress, on an evaluation of functions, to develop the structure and elements of computer programs.

By using Functional Programming, language code threads result in the same values, regardless of the time or machine running the code thread.

This means they can be realized in any language, even one not designed with a default functional programming structure.

All of this enables an easier translation into an interactive environment, making the understanding of code easier... in theory!

The object-oriented technique works on the interactions of one or more objects.

An object being either method, a data structure, or a function.

Each of the created objects can be reused in the same programs and applications. This differs from functional programming, where it focuses on functions/behaviours.

The key differences between Functional Programming and OOP;

                1. Functional programming is used for performing many different operations for which the data is fixed, whereas Object-Oriented Programming is used for performing operations that have a common behaviour and different variants.

                2. Functional Programming's programming model is stateless, it doesn't track interactions.  Whereas Object-Oriented's is stateful (usually by tracking interactions by setting values in a storage field)

                3. In Functional Programming, a state does not exist. In Object-Oriented Programming, the state exists. You have state when you associate values - numbers, strings, complex data structures - to an identity and a point in time.

                4. In Functional Programming, a function is the primary manipulation unit. In Object-Oriented, an object is the primary manipulation unit.

Coming up next week: What is Java?