Abandoning OOP (2/13/2017)

Ryan Fleury  —  11 months, 1 week ago [Edited 8 months, 3 weeks later]
Hey everyone!

I've thought quite a bit recently about what it means to code in a handmade fashion, and what that means for the structure of a program. Through some of my work at the university I'm attending, I'm beginning to see the problems that an object-oriented approach presents to the quality, perfomance, simplicity, and straightforwardness of a program and how it works.

My coding style has always, since I've started C++, involved some sort of object-oriented approach. While I've dropped certain traditional object-oriented practices along the way (like data hiding or private data), up until now my code has used certain concepts like inheritance and polymorphism to an extent.

I've very recently realized that an object-oriented style does not solely present a negligible performance difference. I have been sold for years that object-oriented programming simplifies problems and makes them easier to understand, but it has come to my attention that it does the opposite: it rather complicates what's actually happening on the hardware. As a result, some of the fuzzy higher-level details appear to be more simple and easier understood by the human mind, but when a programmer has to deal with what's physically happening (which can never truly be avoided), the low-level gritty stuff dealing with how the program is actually running on a system, it over-complicates effectively everything.

The result of an object-oriented system seems to be, to me, an inconsistent cluster of representations of reality and the system that they're being represented on which operates on a completely different set of principles.

So, that being said, my next objective in the development of this project is to overhaul any portion of the code that uses an object-oriented approach and adopt a more handmade, C-style approach that will work with the hardware instead of against it. I'm not going to handcraft every aspect of the software for mostly pragmatic reasons (the goal is still to release a game in a reasonable amount of time); I will still be using OpenGL and OpenAL (among some other libraries), but I am dropping the object-oriented approach I've used for many years. Because I've only ever programmed with an object-oriented approach, this is a huge step in my programming journey, and I couldn't be happier to be surrounded by a community of like-minded individuals who are (hopefully) prepared to help me along the way.

I figured this was worth sharing with HMN, as its relevance in my life couldn't be more prevalent currently.

Thanks for reading, guys!
#10890 岩倉 澪  —  11 months, 1 week ago
#10891 Bret Hudson  —  11 months, 1 week ago
Yay! Getting to a point where you can see things like this is so liberating, and I hope it brings you to great new places. Overhauling an entire system is a huge pain, and it'd be super neat to hear what systems you're tackling and how you plan on doing so.
#10892 Allen Webster  —  11 months, 1 week ago
It fascinates me how programmers who try to stop using OO often have wildly different ideas about why their OO was going wrong. My problem was that abstracting early and often made the high level ideas more confusing, whereas you seem to be saying that OO was not a problem for you that way, so interesting.

Anyway good luck!
#10893 岩倉 澪  —  11 months, 1 week ago
Back before handmade hero was a thing I was into C++11 and following the standardization of C++14 and used OOP. One of the big issues I had with not necessarily OOP specifically but modern C++ in general was the complexity of doing things right within that school of thought. There are so many ways to shoot yourself in the foot that you need to constantly have hundreds of gotchas in your head, and it just crippled my ability to actually focus on the real problems.

Perhaps a bit off-topic, but here is a fun talk about some complexities of C++ from a few years ago
Log in to comment