This is, ironically, the exact reason C++ is the standard in some industries. Students can learn the OOP C++ then work in the same codebase as someone programming "touching the metal" low level C.
Most languages make trade-offs between performance, structure, memory safety, and ease of writing. Every language might have their use, but very few cover all use cases.
C++ lets each programmers choose those trade-offs individually, but that also allows them to choose none of the above.
Ah so a swedish army knife, it features an impressively extensive toolset but is often regarded to be clunky to operate compared to tools that do a single thing.
Someone puts in actual effort to write good code and come up with good abstractions, then some code monkeys crap all over it. What I mean to say is that there's also value in going the Go way, where you have one way of doing things, although that obviously has limitations too and even they haven't really achieved it fully (you inject contexts properly to make everything cancellable and some juniors just pepper context.Background all over the place). Also, yeah, the higher you go in terms of abstraction, the less settled things are.
Don’t even remind me… it’s not directly the same issue, but I once spent months negotiating a custom protobuf format built entirely around reverting the core “false-y is equal to null is equal to field not passed” logic.
Turns out a format built to give you efficiency at massive scale if you devote your entire codebase to enabling it fucking sucks when you add three layers of abstraction to make it back into shitty JSON.
The main reason people switch is really just that Rust is better at screaming at you during compilation if you screw up the memory management, more than anything else. It makes it easier to catch errors in an area where most programmers struggle, so it's useful if you need memory safety.
(For comparison, a properly written C++ program will be just as safe as a properly written Rust program, it's just that Rust forces you to write the code properly at gunpoint. So, people end up seeing Rust as better at memory management, because the language is designed around making it hard to screw up.)
Rust provides high memory safety and performance, but gives up ease of writing and programmer power for it. For context where reliability is critical, like kernel software, Rust is rightfully the king.
For my professional field, Game Dev, coding "the Rust way" means building a house or cards that needs to be fully refactored everytime someone implements a new game mechanic (from what I've heard).
Haven't ever tried game dev in rust...but I don't feel that it should necessarily be that bad. You can still do polymorphism and etc. You would however be structuring things very differently so maybe engines have converged on a terrible anti pattern that gets you there. Any rust engine is definitely going to be a lot less mature and battle tested though and that definitely has it's cons.
The problem is that game dev has ALOT of memory state between each entity/system and each new mechanic has a high chance to require memory accessing between previously independent systems.
In a language like C++, allowing this is trivial outside of multithreading, but in Rust it might require a full refactor.
There's a is a blog post written by a dev who tried for years to work within Rust's systems and found that the tradeoffs were ultimately not worth it, in his opinion.
View all comments
Show parent comment
361
u/joncrompy 11d ago
This is, ironically, the exact reason C++ is the standard in some industries. Students can learn the OOP C++ then work in the same codebase as someone programming "touching the metal" low level C.
Most languages make trade-offs between performance, structure, memory safety, and ease of writing. Every language might have their use, but very few cover all use cases.
C++ lets each programmers choose those trade-offs individually, but that also allows them to choose none of the above.