Oleh Baranovskyi
1 min readJan 6, 2022

--

Hi Lincoln Alves,

First of all, thanks, I'm really happy that you did like the article.

"... the same general idea could be achieved by creating custom functions instead of a whole class, right?"

I wouldn't state that FP is better than OOP; both are good. In my opinion, when the algorithm isn't complicated, and you have no plans to extend it later on, you can use a function instead.

However, when the algorithm has many lines of code and is complex, you might want to use class in place of function to gather everything in one place and not make significant functions. Moreover, you can extend a class later and use it as a base for similar algorithms.

With regard to static methods, variables, etc., it's not good from an OOP standpoint. Of course, it's not a deal-breaker, but still, I would prefer to avoid it. There is a great book called Elegant Objects by Yegor Bugayenko.

I hope, these are the answers that you were looking for ;)

--

--

Oleh Baranovskyi
Oleh Baranovskyi

Written by Oleh Baranovskyi

Frontend Lead & Architect | Web community manager https://obaranovskyi.com/

Responses (1)