Formatting vs Architecture: How formatters are erasing visual cues and hurting codebases
I’m preparing a presentation on how automatic formatters can actually ruin code management over time. This relates heavily to the ongoing discussions about C++ memory safety and why some people see it as a critical issue while others don't get the fuss since basic memory allocation isn't that hard.
Memory issues are usually just a symptom of architectural failure, not a lack of developer skill in handling allocations. A messy architecture turns minor oversights into catastrophes. That's when hidden memory leaks or memory corruption become critical safety flaws and crashes.
I often think about the (nowadays) hated Hungarian Notation. Love it or hate it, it made developers extremely efficient because it provided immediate visual cues. Developers who actively care about the visual shape of text think completely differently about code structure. If you look at Charles Simonyi's other work, it’s clear how much focus he had on architecture.
Formatters can be an absolute disaster for architecture. It has become a religion in development teams that everything must be run through Prettier or Clang-Format to the letter. But the price we pay is that formatters erase all opportunities for visual cues regarding architecture and layers.
Architecture is WAY more important than formatting.
Code is text. By deliberately allowing flexibility in how to format, we can highlight major patterns and make code much easier to reason about. When a formatter forces all code through the same rigid, mechanical template, all code looks identical. The architecture becomes invisible. Ironically, this causes codebases to rot because developers in the team can no longer see where the architectural boundaries actually are.
Formatting in itself isn't bad, but it must be a formatting style that elevates the architecture and allows for human semantic grouping. The opposite is dangerous.
As far as I know, there is no formatter out there today that is anywhere near capable of handling the flexibility required to actually make architecture visible in code.
What are your thoughts on this? Have formatters made us blind to the actual structure and layer belonging of our code?
EDIT
To those of you who only see problems with this approach: what is your actual alternative for managing cognitive load at scale?
The common stance seems to be "just write code however you want, as long as the automatic formatter makes the layout look consistent."
But formatting only fixes cosmetic consistency, it doesn't fix structure, architectural boundaries, or intent. If you believe that naming conventions, prefixes, and semantic text layouts are useless, you are essentially advocating for visual anarchy disguised as "clean text". How does a mechanical linter help a new developer navigate architectural layers in a large codebase if the code itself provides zero visual cues about where the boundaries go?
View all comments
Show parent comment
1
u/gosh Jul 05 '26
And that is not surprising at all. Most games are transactional software. They are written under extreme time pressure, often with the mentality of "get it out the door and see if it sells." You cannot over-invest in long-term architecture for a product that might be dead in six months.
Also you need to find developers, adapt to developers that you can get. The pay for game development is not sky high because there are a lot of new game developers out there.
But look at a general-purpose game engine, or an operating system kernel. There, you have a completely different situation. You are designing for a lifespan of 10 to 20 years. The code must be written differently because consistency and architectural boundaries are everything.
You asked for a verified argument of how a formatter ruins this, so let me give you a concrete example of the mechanism
Mismatched layers is a data-transformation problem. When code in the presentation layer (View) starts to execute heavy domain logic, or when domain logic starts touching raw database/infrastructure details directly, the architecture rots.
If a developer does this in a codebase with a rigid auto-formatter, the bad code looks visually identical to the good code. The formatter wraps the lines, indents the brackets, and cleans up the spaces mechanically. It "beautifies" the architectural violation, making it invisible to the human eye during a quick scan or a pull request review. The machine hides the architectural rot by standardizing the text.In contrast, when you allow semantic text layout, developers can visually group and structure text differently depending on the layer or the data lifecycle. A massive, bloated architectural leak looks chaotic and stands out like a sore thumb in the text flow before it ever reaches a compiler or a QA check.
For example: I use very specific abbreviations for primitive or core types—only those. All other variables start with a full descriptive name, like std::vector<some_object> vectorListOfSomething;. When you write code like this and class names get too long, the code visually becomes ugly. And you shouldn't have long class names, as that is usually the first indication that you are violating the Single Responsibility Principle (the S in SOLID). With Hungarian notation, you can intentionally create styles that make bad code look physically ugly on the screen. That makes it a lot simpler to spot immediately.
There are plenty of other things you can do, especially when combining this with comments in code.
I use *_g for globals, *_s for statics, and *_d for debug code. I also use namespaces strictly for general, company wide code, code that is meant to be shared between completely different projects in that environment. However, I use no namespaces for local code that is confined to a single target.
Why use namespaces for shared code but not local code? Because you work with local repository code constantly, and local namespaces just add noise and make the code harder to work with. Shared company-wide code has namespaces, so you can spot it instantly in the local file when it's being pulled in. For general, write-once-run-everywhere code, I use lower_camel_case to match the STL. These styles exist to guard the code, because modifying shared code is always high-risk.
Another division I enforce is between value classes, collection classes, and facade classes. I try very hard to stick to these three types and follow that pattern as closely as possible. I can tell exactly what type of object it is just by looking at the name.
I also use folders to divide layers in a specific project, so placement explicitly shows intent. This folder structure is more important than pure functionality. It is always better to spend a little more time keeping the folder pattern intact rather than hacking a quick solution into a random file.
Naming is VERY, VERY important as well, but this text is already getting long. The point is: I use names in a highly specific, architectural way.
So, what am I actually saying here?
Managing code architecture is a massive, nuanced discipline, but you have to be open to letting the text speak to you. Using a rigid, automated formatter destroys all of this. Every single one of these subtle, visual defense mechanisms just stops working.