18
Geoxion
7y

So today I saw another 'OOP should die' article.
And I decided I should google around a bit to find out why.

Reasons I found:
- Things get too complicated
- Things get too abstract (same as the above really)

But when I search for alternatives, only functional programming and different ways to use OOP get mentioned.
I still don't get why OOP is supposedly bad though.
Maybe my 20-30k LOC projects aren't big enough to see it?

For me the abstraction works very well. The abstraction is used to keep the complexity low(er).
And the different ways of using OOP are a plus-point for me. (Like the Entity-Component system)

I don't know enough about functional programming to be able to say it's better or worse, but the ideas behind it a perfectly usable in languages like C#.

So if any of you have a good concrete reason to not use OOP, please feel welcome to tell me in the comments :)

Comments
  • 10
    It isn't cool anymore
  • 5
    @lumi I was sarcastic, personally I'm perfectly fine with OOP. I like functional too. Or even procedural.

    I just think that each paradigm has its own use. A good developer knows when to use which.
  • 1
    @lumi want a great pure functional language? Try Haskell and you won't regret it ;)
  • 4
    OOP works well when you initially set up a project. You have a button class which all other buttons inherit from etc. But then 2 years down the line someone creates a Button2 which inherits from SmallButton which inherits from Button. Because some idiot didn't follow the whole inheritance chain. Aaand the complexity starts and it's very hard to fix.

    There are many other examples but I think OOP has a lot of useful features but a lot of unnecessarily complex features that doesn't make much sense to use (polymorphism for one).

    I work in a codebase which has all the classic OOP things going on and it's a fucking mess!! (It's pretty old so a lot of people have worked on it)

    Functional for example has its twerks as well, fucking believe me, but if I get to choose I take the good things from both and mix and match.
  • 8
    @zshh I can imagine that happening, but that is a mistake by the programmers, not the concept. Possibly a case of poor documentation.
    And also, like you said, such a mess is not exclusive to OOP. The last few feeks I've been dealing with a couple thousand lines long C library. That library sets and reads many unrelated variables in one big fat struct in almost every function.
  • 0
    There, take some ++ for the Entity Components System design x)
  • 0
    @Geoxion Yes of course, it's the developers fault. But these things happen, it's the reality we live in - people fuck up. And when you fuck up when there's a big inheritance tree going on it will be harder to fix than if there's not.

    Look at it like code comments. When you write them they make sense and they might even help a person or two. But eventually some jackass will update the code but forget to update the comment, so you'll end up with a lying comment. This is bad. This will cause problems. I'm not blaming comments, they can be useful, I just avoid writing them in my code. Same with OOP, it can be useful but I'd rather not take the risk if it's a big project which will be worked on my other people than myself.
  • 0
    @zshh u said polymorphism is pretty unnescesary?
    OMG, if you don't use polymorphism on POO your dead, imagine using a 3D library, but managing each mesh position has a different way of doing it, different messages, do you know bytw what is polymorphism?
  • 0
    Functional exists because people don't know how to use objects properly on POO. It has far less complexity, and can't grow as much as POO programs.

    Why you have to create a new entity for each simple change in functional? You can manage easily simple code in functional, but watch it grow and you'r time is over
  • 4
    @BrianCraig haha you said poo. That is a bad word
  • 1
    @penderis lol its because im from Argentina, here the acronym to OOP is POO because it's "Programacion orientada a objetos", the same just inversed, my fault
  • 1
    It's a bit hard to maintain state in OOP reliably. Particularly when you start scaling horizontally. The code just gets harder to reason about because you don't fully understand what the state is at any given time.
Add Comment