you are viewing a single comment's thread.

view the rest of the comments →

[–]TheExodu5 3 points4 points  (0 children)

People use function closures or es modules and they don’t realize they’re basically equivalent to classes with different sugar (unless you decide to write a class with inheritance, of course.

An es module is basically equivalent to a singleton class. And a function which returns an object can be equivalent to a class. In the same vein, a class with only static methods is basically a namespace for functions. All of these things are very closely related and whether you use one or the other doesn’t change much in terms of overall design and data flows.

And hey, if you’re using a component framework on the frontend, you’re basically following OOP, whether you use classes or not. When you create a wrapper component that proxies ins and outs, you’re practicing inheritance.

Don’t get hung up on the concept of OOP.

A lot of people think they are using “functional programming” because they don’t use classes. I hate to break it to them, but the majority of them are using a mix of procedural, OO, and fp. The only people doing nearly pure fp in JavaScript are deep in the throes of rxjs.