Hacker News new | past | comments | ask | show | jobs | submit login

yeah. The biggest, ugliest C++ code bases I've seen were for AAA games. Some of the best programmers work in games, but you also see lots of grads and staff churn. TBH I have never seen a big C++ code base I liked.

Unity may have its detractors and genuine deficiencies but the Unity projects I worked on were much more maintainable due to the constraints of working inside Unity itself.




Yeah, early in my career I was making simpler 'kids' games and was dreaming of working on AAA titles ... That's until I actually shipped the first AAA and it's ball of mud-like code. It's funny because the impression I had before was from all the GDC talks from big studios always seem to have an awesome codebase that was refactor mercilessly. Not so ... I know now ...


> Unity may have its detractors and genuine deficiencies but the Unity projects I worked on were much more maintainable due to the constraints of working inside Unity itself.

As a game developer who mostly worked in Unity, this is horrifying. Unity-based projects are pile of horseshit in terms of architecture and organization, and I honestly hoped that AAA stuff is held to a higher standard.


AFAIK, the main requirement for AAA games is to ship something in time (Christmas doesn't wait) that runs fast enough. And the thing to ship is the game, not libraries that will help making the next game easier.

It may have changed a bit now that hardware speed doesn't increase that much anymore, but historically, that even applied to game series. Even if you knew there would be a sequel, that sequel would target vastly improved hardware, which means new graphics effects, higher-resolution textures, etc.

That is not an environment that leads to high-quality code. The ability to update a game over the Internet hasn't improved that situation, to state it mildly.


Yup, you usually fork the engine at some 8-12 months out from ship with the intention of never merging back(or very little) to mainline.

I remember when we'd take UE3 drops, it's take one engineer a whole month of compiler errors + fixing stuff to get it back to where we started with.



Chromium is nice, but it also uses a restricted subset of C++: std::unique_ptr, std::move, <algorithm> are okay, but no exceptions, shared pointers, etc. Most large C++ code bases are similar. LLVM also outlaws exceptions. Don't know about Firefox.

So, while these code bases are wonderfully informative and good to learn from in many ways, they won't teach you "modern" C++ styles. I put "modern" in quotes because there's nothing wrong with choosing a style that doesn't use the latest whiz-bang features.


> Most large C++ code bases are similar [...] outlaws exceptions

While I can understand the ideas behind it, exceptions do cause head aches, I find it really weird. Enforcing this means using a very limited part of the C++ standard library, e.g. no std::vector, std::map, etc, because all those can throw exceptions. If you say no to exceptions but yes to std::vector then you either need to write code that works in the presence of exceptions (which means you could just say yes to them) or you have shoved your head in the sand like an ostrich thinking if you can't see them they can't happen.


Large source bases take time to build, and if they're large now, started before those features became widely available. But look around a bit -- you'll find plenty of equivalents. Chromium has its own smart pointers library, and there's a good chance that they'll start shifting to the standard stuff over time.


You also have companies which jump on the google style guide bandwagon.

It's a fine guide, but it was written for google and has some stuff in there as a result of that (no exceptions being on example).


> TBH I have never seen a big C++ code base I liked.

In what languages have you seen a big code base that you liked? Just curious.


Not the OP, but in C I've liked Linux well enough (though it's not perfect), and PostgreSQL and SQLite are supposed to be examples of very well structured code.


The quake sources are supposedly pretty good.


The quake sources taught me many lessons on how to structure C code!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: