If you’re following frontend experts on social media, you hear a lot about how great (reactive) functional programming (FP or RFP for short) is for frontend development. Or even that object-oriented programming (OOP) is bad and that we should no longer use it.
Then you go to your day job, you’re doing OOP and you feel like you’re the only one on Earth still using it.
The truth is, everybody in frontend development will encounter OOP in some form sooner or later, even if they claim to be doing pure (R)FP. Don’t let social media misguide you, OOP is still widely used in the industry and Javascript is very much suited for OOP.
Javascript’s Web API’s and many popular open-source libraries use OOP techniques. DOM Elements make use of inheritance to define different kinds of elements and use the observer pattern for events.
The most popular frameworks, React and Vue.js still have the “OO” approach as the default in their Getting started tutorial even though they have a full-blown functional API.
A lot of attention is going to FP these days, but OOP isn’t evil and certainly isn’t dead. Javascript is a multi-paradigm language, it allows you to use OOP and FP techniques together.
FP is great, but there is no reason to limit yourself to FP because “OOP is dead” or “only FP bro”. Learning more about it might prove to be more useful for your career than learning about the latest library or framework that will be deprecated by the time you get a chance to use it.
Grasping foundations enables you to learn new technology more quickly, which is very relevant in frontend development.