OOP VS FP

23 Apr 2018

Ok no war here, I’m a noob, but just collating what people say online:

  1. When dealing with data about people, use functional programming.
  2. When dealing with data to model people, use object oriented programming.

  3. Immutability is a key aspect of FP - the values are always the same over the existence. Leave the original array untouched and return a copy of the array, edited.
  4. We don’t always know the value of an object at any one point in time, unless you walk through the entire workflow to find out what changes have or have not been done to it.

  5. FP does not mix data and behaviour. Write standalone methods and pass two arguments - the original data and the value to change it by.
  6. Data is supplied to an object at the time the object is created, in OOP. Then, use the object’s methods to interact with the stored data.

  7. FP - Blocks of statements which manipulate data.
  8. OOP - combine data and functionality and wrap it inside something called an object.