From Functions to Classes: My Journey Back to OOP in JavaScript

Hey devs 👋,

Let me take you on a little time-travel.

Back in college somewhere around my second year. I was introduced to the magical world of Object-Oriented Programming. You know, the good old class, object, inheritance, and the legendary "Evergreen Library Management System" project. I was into it. I even tried implementing OOP concepts in small Java projects, and it felt like I had finally unlocked the Matrix.

But then...

I discovered web development.

HTML was welcoming. CSS was confusing. JavaScript? it was love at first script. ❤️

And that’s where I started shifting. Slowly away from OOP. I mean, JavaScript didn’t force me into OOP, and most of the tutorials, libraries, and frameworks I came across were all in on functional programming. It felt simple, elegant, and honestly, it just worked.

I started building projects with my friend. From basic websites to full stack applications. Life was good.

But then came my internship and suddenly, I was inside an enterprise-grade application, and reality hits. I think that’s enough let’s focus on the context now

1. The Functional World We Inherited

To be honest JavaScript has a weird relationship with OOP.

It supports it, but doesn’t enforce it. And most libraries especially the older ones lean heavily toward functional programming.

You’ve probably seen it:

  • Reusable functions everywhere
  • Pure functions with no side effects
  • Higher-order functions, composition and lot more.

And to be clear: functional programming is awesome. It’s powerful and elegant.

But when I started looking at large-scale applications during my internship. Every file was structured around classes, inheritance, design patterns, and I was like, “Wait, is this JavaScript... or did I accidentally open a Java repo?”

2. The Mindset We All Had: “OOP? that is over engineered”

When you're solving real-world problems with JavaScript, you might think:

OOP? Nah bro, I’ll just slap some functions together and hope for the best.

I get it. That mindset works fine for:

  • Small projects
  • Side hustles
  • Personal portfolios

But in enterprise apps, it starts to show cracks.

You find yourself:

  • Debugging deep callback hells
  • Juggling utils with unclear responsibilities
  • Reading code that feels like spaghetti... but uglier

That’s when I realized structure, boundaries, and design principles matter.

I thought my code was modular until I tried to change one thing and 42 files broke.

3. So... Do We Need OOP in JavaScript?

Short answer? Not always.

Long answer? You’ll thank yourself for knowing it.

3.1. It Sharpens Your Thinking

OOP helped me think in terms of:

  • Responsibility (Who should do what?)
  • Encapsulation (What should be exposed?)
  • Reusability (How can I write it once and use it well?)

Suddenly, I wasn’t just writing code I was designing systems.

OOP turned my functions from anxious teenagers into responsible adults.

3.2. It Helps You Decode Complex Codebases

Ever opened a third-party library and felt like you were reading ancient alien scripts?

Well, OOP knowledge helps.

Understanding concepts like:

  • Composition vs Inheritance
  • SOLID principles
  • Patterns like Factory, Singleton, Strategy

3.3. But Let’s Not Get Carried Away

I still stand by this:

Don’t over-complicate simple things.

If a function is just formatting a date? Keep it functional.

But when you're building a system that involves:

  • Multiple layers of logic
  • Shared responsibilities
  • Scalability concerns

Then thinking in OOP terms will save you hours of debugging and countless “Why did I write this?” moments.

4. Me as a TS Dev Today

I like trying new patterns. I love tweaking things. I enjoy the freedom JS/TS gives me.

These days:

  • I use functional code for utilities, helpers, and simple logic.
  • I use OOP when I need structure, abstraction, and clarity in larger systems.
  • And most importantly I choose based on what the situation demands, not what’s trendy.

It’s not about “Functional vs OOP”.

It’s about knowing both, and using them wisely.

5. Finally, What I’m Really Trying to Say...

If you’re a JavaScript dev avoiding OOP because it feels like overkill trust me, I get it.

But here’s a pro tip from someone who took the scenic route:

👉 Even basic OOP understanding will level up your ability to read, write, and reason about code especially in large teams or codebases.

And don’t worry you don’t have to give up your arrow functions or map/filter/reduce.

You just need to add another tool to your belt.

So go ahead earn about class, constructor, extends, super, and all that jazz.

Even better: wait for my upcoming blogs. I promise it won’t be boring 😏

Functional and OOP aren’t enemies. They’re like Batman and Superman. Annoy each other, but stronger together.

Catch you in the next post 👋

Thanks again for reading!

Feel free to share this post with fellow devs — and if you’ve got feedback, ideas, or questions, I’d love to hear from you.

Comments

Add a new comment

Stay Connected

GitHub •LinkedIn •X •Daily.dev •Email

Š 2025 Chiristo. Feel free to share or reference this post with proper credit