5
leifertin
182d

OOP coder:
OOP is so useful and realistic!
Let me give you an example -> Cat extends Animal.

Every other coder:
So how is that useful in reality?

OOP coder:
...cat pictures?

Comments
  • 3
    I like composition more than inheritance. It's a bit more verbose, but a lot more flexible and less confusing.
  • 10
    Oop coders be like `class Table extends Cat` because it has 4 legs. Successfully made it DRY and SOLID 🤡🤡🤡
  • 5
    Composition is almost always a step into an unmaintenable graveyard of mines.

    OOP examples are usually useless. :-)

    When you wanna learn OOP, one of the nastiest and sadly best tasks is to write import -/ export stuff.

    Cells, styles, formats, value classes, aggregation functiona with value classes (median / avg / sum / ...), collections, learning stuff like immutability and that an immutable collection can contain mutable objects (one thing that some devs just not want to comprehend...) and a lot of other funky and gruesome stuff.

    Plus probably learning to have an eye on memory consumption and thus learning stuff like iterators / generators / streams / ...

    If you're a mean mentor like me and give people datasets starting with 4 MB and then growing the dataset exponentially. :-) (6 datasets, 4 MB, 16 MB, ... etc)
  • 1
    @cuddlyogre agreed! They say inheritance is the tightest coupling you can get and I can believe it
  • 1
    Another try-hard dev trying to expose OOP as if it will change anything. SMH..
  • 3
    OOP is good when used correctly, composition is good when used correctly. Problem is in Developers wanting a quick and general solution to their problem.

    Combine that with us saying "everyone can code" and you get a generation of devs hating any paradigm because they dont understand it well enough, create subtle bugs and code themselves into a corner.

    I am no exception, but every pradigm has pros and cons and neither is THE solution to all of your problems.

    The world just doesn't work like that.
  • 0
    @devRancid what you're describing is "duck typing" - which is _literally_ the exact opposite of proper typing.
  • 1
    Let's couple out with the fact (as so evidently demonstrated by some here) many devs don't really understand OOP or inheritance.

    Classes are all about invariants, and most OOP inheritance chains (that includes examples, yeah), fail to understand that subclasses must not relax superclass invariants, yet do.

    So in the end, they treat inheritance as a cheap way of achieving dynamic dispatch without thinking too much, and get flabbergasted when they discover that, for example, containers can't have their contents downcasted and stuff like that.
Add Comment