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/JVApen Clever is an insult, not a compliment. - T. Winters Jul 12 '26
Taking your book example. Would you be able to get info from the book when all titles would be using the same font and size? It's due to the formatting of H1, H2 ... that you are able to grasp what the purpose of the headers is. Though even if that is consistent, how distracting is it for the text below it to have paragraphs left, right, middle and justify-aligned? How distracting is it if image descriptions would be using text above and below, sometimes in bold otherwise in italic. How about using different sizes of whitespace between the different lines, or chapter titles at the end of a page.
If anything, books are an extremely well example of why formatting is important. It's that way such that it doesn't distract you while reading. And yes, titles are important as well. If either the structure or the formatting is broken/missing, the book becomes much harder to read. They don't conflict, they augment each other.
Just like books, C++ has constructs for the structure: namespaces, classes, functions. It has a separation between headers and sources such that details can be hidden.
Mapping this back to the example of the multiple values. Your function is like a chapter in the book. The code you have is all the text in paragraphs right below it. By adding the abstractions, you reduce your text into 1 or 2 paragraphs. Very consicely giving the message that you want to bring with references to the details that follow later (or have been discussed in previous chapters). Than you have a subchapter per abstraction, which describes in detail how specific elements are implemented.
With this, you can read your index, find the chapters of relevance. Then you read the top paragraph(s) to see if everything connects as expected. This allows you to quickly eliminate irrelevant chapters. When you do observe something of relevance, you can deep dive in the subchapters mentioned.
At the same time, such a subchapter is much more focused as well. Where parts of the value packing was described in bits and pieces throughout the text and one has to search at many places to understand how the packing works, a subchapter can group the info, add extra context and clearly describe the contract of the piece of code.