Object-Oriented Programming is Bad

4    16 Feb 2016 08:18 by u/go1dfish

4 comments

1

I thank you for this, Sir. I came to Voat for exactly this reason, to find an opposing, unconventional, non-mainstream views. This video expresses my thoughts about OOP very well.

It's very important that we continue to grow and not fall into these ever-changing trends of "hey, this year this is the right approach and if you don't follow, you must be a moron".

0

Glad you liked it, I'm personally working on switching to a more pure functional style myself and this video helped convince me a former die hard OOP guy to consider such a change.

0

This is the written form of this article.

He basically starts with a false definition of what OOP is and then proceeds to make disjointed arguments that have very little or nothing to do with his premise and have little to do with actual OOP is. What he has written seems to be targeted more towards Java and its particular coding style (which I, personally, would agree is terrible) than OOP in general.

If you don't actually know what object-oriented, procedural, or functional programming is I would advise you not to listen to random people on the Internet telling you that OOP results in "bad abstractions" and that procedural programming is "superior".

-1

Yeah, about halfway through I realized he was complaining about object oriented architectures, particularly very formal architectures that attempt to enforce rules about how object interact through a graph, a graph which actually does not correctly describe the architecture.

Towards the end the author is critical of this type of programming:

doSomething();
doAnotherThing();
doAThirdThing();
doTheFinalThing();

He argues that he would rather do this:

// do something:
for () {...}
// do another thing:
for () {...}
// do a third thing:
if () {...}
// do the final thing:
switch () {...}

which strikes me as extraordinarily foolish. The purpose of breaking up 100+ lines of procedural code into single-use functions is that it allows you to make modifications to the code on two levels: outside of the abstraction (in the top level function) and inside the abstraction (each of the inner functions). So you could change this:

taskApple();
taskBanana();
taskCherry();

into this:

taskCherry();
taskApple();
// taskBanana();

... or if you want to get really fancy, you could handle the functions themselves as references and produce dynamic code:

func plan[3] = (taskApple, taskBanana, taskCherry);
foreach (plan as step) {
  step();
}

which is of course something that no one ever does, at least in open source projects, because it requires a certain level of skill... and doesn't play well with your IDE.