Lead Developer, business owner, US Army veteran. I build things for the web. My website is a bunch of HTML pages that didn't need a framework. Yours can be too!
While it's true that JS doesn't have private properties, but this is a solved problem (No Typescript necessary!)
Use the Revealing Module design pattern, and you can have a public/private API for your module.
That said, I also believe JavaScript is trending more towards the Functional Programming world, and I'm an advocate for that direction. That doesn't mean that OOP is outdated or not something to learn, just that I don't think it's the best fit for most (but not all) JS applications.
I can't wait for the industry to reach a better balance between functional approaches, which are GREAT for stateless, event driven actions (IE: Your typical microservices web backend) and OOP which are much better suited for stateful, context dependent actions (Like you might see in an application designed to run independently without API support, like a desktop app or a game).
Both are useful, but I've seen a lot of people trying to use one or the other as a hammer, when all they have are a box of screws!
While it's true that JS doesn't have private properties, but this is a solved problem (No Typescript necessary!)
Use the Revealing Module design pattern, and you can have a public/private API for your module.
That said, I also believe JavaScript is trending more towards the Functional Programming world, and I'm an advocate for that direction. That doesn't mean that OOP is outdated or not something to learn, just that I don't think it's the best fit for most (but not all) JS applications.
I can't wait for the industry to reach a better balance between functional approaches, which are GREAT for stateless, event driven actions (IE: Your typical microservices web backend) and OOP which are much better suited for stateful, context dependent actions (Like you might see in an application designed to run independently without API support, like a desktop app or a game).
Both are useful, but I've seen a lot of people trying to use one or the other as a hammer, when all they have are a box of screws!
Thanks for the comment! I've added a note about the Revealing Module pattern to the post itself and mentioned you π Thanks again!
Totally agree with you, the right tool, for the right need!