From functions to classes: My JavaScript journey

I’ve been avoiding JavaScript classes for the longest time… until I got onboarded to a codebase that uses class to group things everywhere. My expression at first glance: “Oh wow, what a beautiful way to code😊 uhm🤔 what’s the function of "this" keyword again?🤲 O boy ah don enter😀 For a long while, I’ve been using normal functions to solve all my problems without the headache of Object Oriented Programming (OOP). JavaScript allowed me to escape that reality. But after staring at that code for a while — and quietly thinking about my life and whether I even chose the right career😀 — I knew this was a serious wake-up call to level up. Tech is a lifelong learning journey. While a lot of junior devs hate OOP, many people still believe you’re a “better” engineer if you understand it. Whether that’s true or not, I honestly don’t even have the luxury to choose anymore. I needed to save myself 😭 On a shallow level, here’s what I’ve managed to understand so far: A class is just a blueprint or template from which multiple objects can be created or inherited. Still learning. Still confused. But we move. #JavaScript #OOP #CodeJourney #DevLife #WebDevelopment #LearningInPublic #JuniorDev #TechJourney #ProgrammingLife #100DaysOfCode #CleanCode #SoftwareEngineering

  • text

Man, I feel this in my bones! 😄 I had that exact same moment when I dove deep into OOP with PHP and Laravel. I used to think, "Why all this complexity when functions get the job done?" What finally made it click for me was realizing that OOP isn't about being clever, it's about creating systems that make sense to everyone on the team. When you have multiple developers working together, well-structured classes give you a shared language. A new engineer can look at a PaymentProcessor class and immediately understand how payments work in your app. Working with Laravel really opened my eyes to how powerful OOP can be when you: Stop thinking about "what functions do I need?" and start thinking about "what responsibilities does this object have?" Need to model real-world business logic where data and actions naturally belong together Build something complex enough that no single person can keep it all in their head And that whole this confusion? We've all been there! I still explain it to my team as: "this is like pointing to whoever is currently speaking in a conversation." Stick with it, that initial frustration is totally normal. Once OOP clicks, you'll start seeing your code in a whole new way. Welcome to the journey!

Truth is without a clean architecture people abuse OOP. The main objective of a codebase is that it should be readable, when you have an understanding of clean architecture, you’ll understand and appreciate OOP even more. Coming from a language like C, we already had a form of OOP before OOP began a thing because we had clean architecture. We performed encapsulation, inheritance and even polymorphism before being introduced to an OOP language. A good architecture to start with in my own opinion is the SOLID principle. Don’t get me wrong, OOP is a good approach, but it’s even better with a clean architecture

Let's be sincere here, it's very important to understand class but using it makes things bulky-- lots of boilerplates

Developers that are comfortable with OOP often find it easier to solve real life problems than those who don't. This doesn't mean you can't solve real life problems without utilizing classes. Just that OOP simulates the same idea that the universe runs on. Therefore it's easier to relate and come up with solutions

I think engineers understand more OOP practices then they think. They use it constantly with packages that import or even just built in methods. I remember when I was a junior I was desperately trying to get a grip on OOP but then I began to realize I already understood it, and somewhat applied it. The main challenge I had with OOP was determining when it was ideal and when it was overengineering.

Like
Reply

Simple is better than complex.. programming paradigms has both their advantages & disadvantages while OOP is one of the most popular way of structuring computer program modeling real world objects which is perfect for maintaining & updating codebase, it can also introduce boilerplate codes as the codebase evolve..declarative programming also comes with its own advantages too no boilerplate codes.

The truth is OOP looks intimidating at first but when you keep on going you'll enjoy it Thank goodness for my mentor who forced me to learn it Right now all my backend codes are all OOP

The _this_ thingy is a reference to that object (that Animal object) so _this_ is the object reference, then access it's methods and properties with the .the_method_or_property. I don't know if design patterns become relevant without OOP

That it Tech like you said, it's a school that you will never graduate. As in is a professional that learning never stop. Even my instructor tell me that, hey i am still learning ooo. The day you stopped learning, that the day you graduate.

Many developers shy away from OOP but it's the best approach to programming. After learning OOP, many regret why they didn't learn it earlier. I have seen senior devs stick with old approaches because they still work. But continuous learning is what keep some of us going.

See more comments

To view or add a comment, sign in

Explore content categories