I'm about to embark on a journey where I let go of the typical way I program and try something radically different as an experiment. I've been programming for a little over 15 years now and I have grown tremendously, but recently I've felt like I haven't been as productive as I've been in the past. This feeling has become stronger watching Casey Muratori code live on stream for his Handmade Hero project. The man is just non stop pumping out code like there's no tomorrow with seemingly no effort. What's funny is that I feel I've been the same way when I was less experienced, but nowadays I feel like most of my time is spent on thinking on what should go where, how objects should interact, what should be private or protected, should I have a move constructor or delete the copy and assignment constructor etc. What I want to find out for myself with this experiment is whether I can be more productive in a large project over a reasonably long time following a new, or rather old, way of programming.
Every experiment needs an hypothesis!
I'm not going to be all scientific about this, but I have an hypothesis. As you're learning to program, you're unfamiliar with a lot of concept and you make a lot of mistakes that you learn from. Often times you don't really know what the correct solution is, feeling like there is such a thing (there rarely is :(). You'll scour the internet and you find all sorts of patterns and paradigms, you'll love them and start applying them everywhere. If they don't fit the problem, you'll make it fit god damn it, silver bullets everywhere. Eventually you come to your senses and you start applying things where they fit instead of forcing it onto everything. You're experienced now, know what to do and when to do it, you make less silly mistakes and you only go "fuck, did I write that?" 9 out of 10 times now. Mistakenly you've attributed this success to the use of OOP, not the experience you've gained. That's what this experiment is about.
What I'll be doing and what not
I will program a complete game (the one I've wanted to make for so long now!) without the use of OOP and some typical C++ features.
If you're wondering what my definition of OOP is, I honestly don't know... or care much, but these are some of the things I'll be doing differently:
- Solve the problem at hand in the most simple possible way, no generalizations until they're actually needed.
- No more combining data with procedures, so no member functions.
- No more templates, I want my compile- and turnaround times to be as fast a possible.
- Start making use of some macros. I've been very opposed to using them before, but I will use them sparingly where they make sense.
- Everything is public, yikes!
- No constructors, destructors, copy/assign/move constructors. But what about RAII!? Well I did say radically different, so I'm going to give this a shot.
That's enough to give most programmers a heart attack. But I wonder, how many have actually tried programming in a different way after they've become experienced and how many just got set in their way? I love programming and I want to keep growing at it, that means sometimes you'll have to visit the no fly zones, just to test if your presumptions are (still) correct.