Introduction
A long time ago I received a lecture about the usage of databases and software design. More specifically, how to translate ...
For further actions, you may consider blocking this person and/or reporting abuse
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?Totally agree. But why? Surely there must be a reason why they tell us that, right?
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.
Part two was just published, we can continue the discussion there if you want :)
Thank you for the article. I'm having trouble to follow your train of thought here though. I prefer functional programming over class based approaches myself but from this article it's not really clear to my why classes suck. Because they nudge you towards overcomplicated solutions? Maybe you can flesh this out a little more?
Yeah, I went for click-bait here. I'm just pointing out that there's something weird going on with classes, software design, and the real world. It seems we can use classes to represent real-world objects, but it also seems doing so sometimes backfires.
They definitely do that too. For more, see the Stop Writing Classes video. But I'm not talking about complexity here, I'm talking about links between code and the real world.
Well, there will be a part two soon and I hope it will make things easier to understand.
Here's part two if you want to check it out.