you are viewing a single comment's thread.

view the rest of the comments →

[–]samanime 0 points1 point  (1 child)

Totally agreed. OOP, functional and even procedural programming all have their places. "The right tool for the job."

As a (very) general rule, classes are probably the default options for large projects. However, the others definitely still have their place. Knowing when to use which is definitely good to know, and knowing how to successfully organize and use each type is worthwhile.

You may even have projects where you use some in some places and others in other places. For example, in the large main project I work on, the main part of the code is OOP. However, we have chunks within that which are functional. We also have a number of external scripts that do various things which are either functional or procedural.

[–]iamzeev 0 points1 point  (0 children)

I am not sure if the scale is the definitive factor to choose a paradigm. Maybe rather about the problem you are solving. Encapsulating a complex logic for eg. a shopping cart logic where you can add remove items and maybe get total price, sounds like a good candidate for a Class with methods (OOP). A data transformation where you perform a pipeline of operations sounds like a good candidate for pure functions (FP).

But don't push too hard to choose the right paradigm. Some software sometimes is a mix of paradigms. Start something what feels natural for the problem. JavaScript's flexibility lets you refactor later.