Hacker News new | ask | show | jobs
Ask HN: HMH anti-OOP movement
4 points by RoboSeldon 3971 days ago
For some time I follow handmadehero.org where Casey Muratori teaches how to implement a game from scratch (no libraries).

I have some trouble conciliating what he (and other people that follow him on Twitch) teaches about OOP with what I've learned in school. Basically they claim OOP is bad, that most C++ is horrible (especially OOP), that the new C++11/14 is unnecessary and that we all should use the C++ compiler to code in a more C like style.

It is particularly troubling to hear Casey and his disciples denigrating books like "Effective C++" etc ... that are widely accepted in the C++ community.

I don't want to start a flamewar C vs C++ on HN, but I was wondering what is your opinion about this anti-OOP movement.

4 comments

You can read some excellent material on the subject here: http://250bpm.com/blog:4

I'm far from being a fan of Casey. I find that he makes strong statements based on weak arguments. He's overly hateful of Microsoft and C++, despite him using Visual Studio and a C++ compiler. He tries to be pedantic but makes a fair share of mistakes. Some of his architecture design choices left me with a straight face wtf expression.

C++ has it's flaws, that's widely known and accepted by the community. It's even highlighted in the "Effective C++" books. Unfortunately, the best advice given is "don't do that". I believe a vast majority of C++ users will gladly switch to a new language that offers the same level of abstractions at a comparable speed (maybe Go or Rust). For now, C++ users have to understand the language well enough to avoid its many traps and pitfalls. Moreover, new versions of the standard add to this burden. I know of no project built entirely using C++14. People will always have to deal with legacy code.

OOP is just another programming paradigm C++ supports. You're not required to use it, and you're not even paying for it if you're not using virtual methods. Sure, C++ allows you to do a lot of funky things from overloading operators to implicit conversions but that's another of those things everybody agrees should not be used unless explicitly necessary. OOP facilitates encapsulation and polymorphism which are great tools when designing software systems.

C has its elegance and simplicity. C++ has its abstractions and pitfalls. There are always tradeoffs.

There are valid arguments to be made about object-oriented programming not being a hammer fit for every nail, particularly in regards to game programming. It's easy to caught up in a trap of organically forcing too much hierarchy and structure onto a project while still in the planning stages. You can tell the awkward, haphazard results of an OOP library that was built on the principle of "whatever the developer thought was a good idea at the time" versus one that was actually engineered - it's the difference between reading a novel in the latter case and a rambling screed in the former.

Unfortunately, I think Casey tends to take his dislike for OOP a bit far, and rather than arguing against using OOP badly, or using it where it isn't really the best option, he seems to reject it in its entirety. There are situations in which it works, and ways to make it work well.

Watching the handmade hero stream archives on youtube, i find it useful to read the comments (one of the few times you should read the comments on youtube) where clearly intelligent and competent programmers call him out on his curmudgeonly bs time and again.

Of course, he's a much better programmer than I am, and he has shipped a game and I have not, so I will listen to most of what he has to say, but when things like const being useless come up I just have to roll my eyes.

I think that this is less a "movement" and more a "group of people unable to take Casey Muratori's personal opinions with the necessary grain of salt."

I didn't followed the Youtube comments, however the comments from the Twitch chat are strongly biased to the no-OOP camp ... It is interesting to see how Casey's followers are more vocal than him. While Casey has technical arguments to reject OOP (more or less justifiable) the disciples seem to have (at least some of them) a visceral hate for OOP which I find hard to understand from such inexperienced people (most of them are students).
I haven't followed HMH nor Casey Muratori, but the notion that C++ is horrible has been around for a long time. Linus Torvalds famously smacked down C++ and gave at least two reasonable objections to using C++ for "system-level and portable" programming needs [1].

Now, is this true for every application? Of course not. Does OOP work well in C++ for some applications? I am sure it does. Can C++ lead you to making poor design decisions? Of course it can, so can C or anything else (except for lisp, lisp is perfect ;)).

Of course, it's all a rather subjective argument. You could always port what you are learning from HMH to C++ and see how it works or what changes in an OOP style. I bet that would be really interesting and educational!

[1] http://harmful.cat-v.org/software/c++/linus

> but the notion that C++ is horrible has been around for a long time

Yeah, "C++ is horrible" is as old as C++.

The exact basis has changed -- early on, it was that C++ did OOP poorly, even compared to other contemporary C-based efforts (notably, Objective-C). Now its more that OOP is the wrong solution.

What are those two reasonable objections?
I think pro or anti-oop sentiments as doctrine are both harmful. There are times where implementing OOP simply to do it could be make your code more complex. I think Casey's attitude may be pushback against the promulgation of poor OOP practices. OOP is simply a tool to put in your toolbox, if it suits you, then use it.