I built a game engine in C++
- Calls malloc once
- Not a single destructor
- No RAII
- No smart pointers
You don't need that stuff if you understand a bit about how memory works
20 years of OOP: "Everything must be an object!" "Inheritance is reuse!" "Abstract all the things!"
2 weeks of data-oriented thinking:
- Here's my data
- Here's what I need to do with it
- Done
The OOP Revolution and its consequences have been a disaster for the human race
In the course I'm currently teaching we are about to do a "pass" on the Metroidvania module and look how the data is all laid out to see where we can get some easy wins
(like this padding inserted here, for example)
programvideogames.com
Modern devs be like: "The hardware doesn't matter!"
Meanwhile their program:
- Thrashes the cache
- Fragments memory
- Burns CPU cycles
You can't optimise what you don't understand
You can't master what you won't learn
Take responsibility for your performance and career
Myth: Pointers are too complex and dangerous
Reality check:
- Pointers are just memory addresses
- They enable powerful, efficient code
- Understanding pointers deepens your grasp of computers
Several generations of programmers have been taught the OOP mindset
It's very hard to unlearn
"Should a rectangle draw itself?"
"Should I create a Manager class to manage my Manager classes?"
These types of questions are so far beyond a waste of time it's absurd
You're defending Garbage Collection because:
- you never learnt about memory lifetimes
- you think malloc/free is the only alternative
- you're scared of what you don't understand
In this case, you can still use Godot regardless of what their community manager thinks, thanks to the license
With other 3rd party engines, you aren't so lucky
It doesn't matter what your beliefs are. It only matters that some people are looking to punish you for them
Why do we make programming so complicated?
99% of what we write is just:
- Reading data
- Changing it somehow
- Outputting it
The rest? Usually unnecessary abstractions
I used Linux for 10ish years. Up until 2023
Your whole system shouldn't break on automatic updates
Your WiFi and Bluetooth should just work
People aren't gonna use it until these things are fixed
Programming is hard
It's hard because we are taught to care about a bunch of abstract concepts
It's hard because those abstract concepts are NOT the code required to solve the problem
data in => transform data => data out
That's what programs do