Combine functional and object oriented programming

Click for: original source

There are many languages that support both functional and object-oriented programming (OOP) such as Javascript, C#, Scala … In my case, learning functional programming (FP) from OOP experience creates some confusion on how to best use functional and OOP together. By Thang Le.

One of the main advantages of FP is providing a clean and concise way to represent business logic. Pure functions are easily tested and organized. Thus in the programming languages that support both FP and OOP, the main mean to tackle business puzzles should primarily be functions.

The article content is split into:

  • Functions for logic and objects for modularity
  • Separating domain models and business logic
  • Immutability in pure functions

Good code structure increases development velocity, reduces the amount of bugs and prevent application growth of complexity. Understanding all aspects of business domain is a prerequisite for well-organized codebase. Thus investing time to learn about the domain you are working on will certainly bring great benefits. Good read!

[Read More]

Tags programming software javascript app-development functional-programming