OOP vs. functional programming. The pursuit of extensibility

Click for: original source

Adam Gajek about his experience with Scala programming language and about criticism about its mixed Functional and Object-Oriented Programming nature. He decided to compare both approaches in terms of extensibility based on the Expression Problem formalized by Computer Science Professor, Philip Wadler, who greatly contributed to the development of Functional Programming.

Our code is evolving all the time. There is always some refactoring, bug-fixing and (hopefully) additions of new features.

Software extensibility is vital so that one of the famous SOLID principles is dedicated solely to this subject, as is formulated by Bertrand Mayer’s Open-Close Principle.

Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.

The Expression Problem focuses on one of the most important features of code: extensibility. This can be described as the ability to evolve without:

  • Affecting the clarity of the existing code
  • Putting much effort into adding new functionality
  • Breaking code that works properly

Read more about this interesting topic in this mini series of articles. Recommended for any programmer!

[Read More]

Tags scala java functional-programming