DEV Community

Discussion on: Classes Suck

Collapse
 
xowap profile image
Rémy 🤖

Classes are definitely not real-world objects, that's just how bad teachers teach it.

If you code in C you'll notice that you often end up working on a given struct/handler/pointer for various operations. Classes are syntactic sugar so self gets passed to all your methods automatically.

And then you have interfaces, which build upon the way classes are exposed to make abstraction of implementation details and let you create abstractions easily.

Sooooo, I'm not sure what's your point. Should main() not be a method from a useless class? Definitely. Are classes bad? I don't know, how bad are knives, pillows or airplanes?

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky • Edited

Classes are definitely not real-world objects, that's just how bad teachers teach it.

Totally agree. But why? Surely there must be a reason why they tell us that, right?

I'm not sure what's your point.

That's because I'm not finished :) I wanted to have a cool cliffhanger in the middle of a two-part series instead of one big boring article. I hope you can forgive me.

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

Part two was just published, we can continue the discussion there if you want :)