I don't believe quality code is subjective
Posted by GolangLinuxGuru1979@reddit | ExperiencedDevs | View on Reddit | 43 comments
Sometimes when developers talk about code. You will find that some people may say "code quality doesn't matter" or even "quality is subjective". First I want to example why people land here, why I think its likely the wrong way to think of code, and that there are some basic principals of software that's objectively good or bad.
I want to make an very important distinction between "quality code" and "clean code". The term clean code gets tossed around a lot. And since it is the title of a very popular book, there is a connotation associated with the term. Let's be very honest. "Clean code" is more of a preferred coding style where the expected side effects are suppose to be maintainable code. Notice I said "maintainable" and not "readable".
So what is quality code? Simple. It is code that has clarity, less congitive overhead, and can be reasoned about. Cognitive load is objective. If I need to hold more code concepts in my head, or I'm tracking functions/variable names across many files in the project. This is more of a cognitive load than just reading something from top to bottom. This isn't always possible to just have everything locally in one file, but the less jumping around the better. This is why I feel quality code tries to reduce indirection.
Clean code is about code organization. But that "organization" comes at a cost in that it forces indirection. Which we know is cognitively expensive. So what clean code hopes to achieve is "code adjustments without needing to understand the broader code base". You just modify a interface, and then system "takes care of it". But this is only the byproduct of ultra ultra mature software. I feel a software industry that is all about narrower, software never reaches maturity like it do 20-30 years ago. Hence clean code applied to teams with no real discipline just feel like over-engineering.
I think quality code is understanding an entire code base. And understanding an entire code base requires reasoning about it not to be cognitively expensive. This also means the code can be modified, and you are able to understand the side effects based on your knowledge of the code base. So it requires thoughtfully managing complexity. But you don't manage it until the complexity becomes so overwhelming. Managing complexity is only through emerging behavior and architecture. Not something you impose on a code base from the top down.
The friction of code quality will always come from adding new features. Code quality is very important in these scenarios. Because the longer a system runs, the more aggressive business teams are about pushing features and deadlines. And when you need to reason about a poorly construct code base, code adjustments feel risky. They also take more time because they become harder to test and debug. So quality code is code that is simple as the system allows it to be. Simplicity is used a lot, but not all systems can be incredibly simple. That is why I say "as simple as the system allows". And that balance is hard, but necessary to not only deliver faster, but not cause latent and hidden bugs in your software.
bluetrust@reddit
If it's objective then make a linter. If you can't make a linter then it's not objective.
Sensitive-Ear-3896@reddit
You must be a joy with code reviews.
cheir0n@reddit
I had a colleague in the past who was only checking the dot, the comma and the capital letters in the code comment (and he isn't even a native English speaker). Like ok cool dude, but you need to review the code.
Sensitive-Ear-3896@reddit
My favorite was the one who would say, "we should implement this too"
NotMyRealNameObv@reddit
About a piece of code not touched nor even related to the changeset under review.
Sensitive-Ear-3896@reddit
Yup it’s like: this works and you’re not fucking yoda
GolangLinuxGuru1979@reddit (OP)
I mean I’m not really like this. I only engage with structure of the code and not trivial things like white spaces . Those are things handled my linters . And most modern languages like Go and Rust shit with their own formatters. This really shouldn’t be a thing brought up in code reviews in 2026
cheir0n@reddit
🤣
cheir0n@reddit
I had a colleague in the past who was only checking the dot, the comma and the capital letters in the code comment (and he isn't even a native English speaker). Like ok cool dude, but you need to review the code.
tim36272@reddit
No it's not. Sally is better at remembering variable purposes than Bob. Bob is better at understanding long (read as: descriptive) variable names than Sally. Bob and Sally disagree on the cognitive load required to understand a code base.
QED.
GolangLinuxGuru1979@reddit (OP)
Saying its objective is saying that
1 function 100 lines is better for some people
Vs
5 functions 20 lines each sate scattered across 5 files.
One you can usually read from top to bottom. It gives your brain continuity
For the other you need to think about references, values, the state of the values.
One is objectively more cognitively loaded than the other
tim36272@reddit
Even if I agree with you on that example (which I don't, I could give you a counterexample that meets your criteria but we would both likely agree flips the decision), my original example counters the statement "cognitive load is objective". You can, at best, claim "there are some narrow cases where one code style is widely considered objectively better than another in most cases".
GolangLinuxGuru1979@reddit (OP)
Cognitive load is objective. The less you need the reason about, the less inputs your brain needs to track, the better your cognitive load. That’s objective.
Saying it’s subjective would be like me saying “oh 1 function vs 60 has no real difference in cognitivr load, it’s all subjective”. One is clearly easier to figure oit thar there other
Because the more amount of functions you have the more you need to reason about the call stack . What calls what? You must remember parameter list and return types.
I’m not saying factions should be thousands of lines because that also has its own mental tax. But to say it’s totally subjective is misleading.
You can say some people may not mind things being split up more. Or that recognizing patterns can help you better navigate . That’s fine, but that doesn’t reduce mental load than if something is just top down vs making jumps all over the code base
tim36272@reddit
I get that in your mind this makes perfect sense and it seems irrational to view it any other way, but you do not speak absolute truth. Good luck in your endeavors.
dbxp@reddit
If the functions are well named then they tell you in short hand what the code is doing which would tend to mean less cognitive load. The same way using a high level language tends to be easier than say assembly. On the other hand if the functions are performing operations which you don't understand it's going to be far more difficult for you.
GolangLinuxGuru1979@reddit (OP)
This is convention. This is a good compromise. You’re relying on nomenclature to fill in the gaps. But keep in mind this is compensation for indirection and splitting things up. It doesn’t mean that the load isn’t there. What you’re doing here is helping manage it
andeee23@reddit
i've had people go crazy in code reviews because i was using arrow style anonymous functions that took 1 line to do some data mapping, they claimed it was harder to understand than writing a named function and passing that as an argument
then i had others saying that putting stuff in a function creates too much overhead when i can just make it a short arrow function so you can see the code directly
which ones were right?
whatever you choose to make your code "simpler" and with less cognitive overhead, you'll have people on either side of it arguing because they're used to one particular style over the other and it's easier for them to understand
Cell-i-Zenit@reddit
arrow function is obviously right ... :D
tbh most devs are bad and arguing with them about simplicity is just not possible, since they have no concept of idiomatic code anyway. Everything is hard for them from a concept perspective.
Izkata@reddit
Satisfy both of them:
const foo_the_bar = bar => foo(bar);CodelinesNL@reddit
You sounds like someone with 5 years experience who never worked om a large codebasr, is still in their first job, and thinks they know everything.
Everything is subjective.
GolangLinuxGuru1979@reddit (OP)
25 experience in many Fortune 500 companies. Across code bases written in Java, Python and Go. And critical systems dealing with payment, telecom, and provisioning.
You can disagree with my points and thats fine. I invite a different point of view . Trying to belittle mean adds nothing to the conversation and is grandstanding
dbxp@reddit
No, no it's not. Try stepping into a domain you don't know vs one where you know all the domain and lingo by heart. Cognitive load is the interaction between the brain and the topic at hand.
metaphorm@reddit
what does it mean for something to be subjective vs. objective?
here's a working definition of objective: measurable through some kind of quantitative system.
that's not intended as a philosophical all-cases-covered definition. that's a provisional and pragmatic working definition. if we use that definition then what do you propose as the objective metric for code quality?
throwaway_0x90@reddit
And then you go on describe a bunch of subjective things as requirements.
Miserable_Heron_9007@reddit
I had this definition in a production engineering course back in U days: quality is uniform ("sameness") output. If your product varies from batch to batch, it has low quality.
I would apply it to software as: if your code varies from feature to feature, it has low quality. In a certain sense, if you implement a feature following a structure you set a expectation.
throwaway_0x90@reddit
Well you're objectively wrong because... the word "quality" itself, is subjective.
socialistpizzaparty@reddit
TLDR - Delivery value, that’s all that matters.
Look, I use to be a quality purist but over the past 15 years I’ve learned that few care. You write code that is good enough to get the job done. Follow as many best practices as possible. But ultimately, it’s about what you deliver and the relationships you build that determine your success.
GolangLinuxGuru1979@reddit (OP)
The issue is how much friction do you encounter extending the software . This mindset only works if the original dev is still around (oftentimes they’re not). Or you never need to adapt the software to business needs.
I feel when people say this they think quality is abstract. Quality software means there is less friction and less unexpected side effects when extending the software. Someone who feels quality is not necessary probably isn’t writing software that has these properties
socialistpizzaparty@reddit
Quality is a spectrum. I teach junior devs where to cut corners where it will have less impact on future work. But starting a new project, trying to abstract everything when you know the business will ultimately change their minds… it’s a fools errand. That’s the kind of thing you gain from experience.
Vertical slices instead of deeply coupled layers can help you find a balance between quality, speed, and reducing regressions. But this does take good technical leadership from a senior, or else it can devolve into a mess.
doberdevil@reddit
This is easy to forget and I hate it. But it's true. And it's a lot harder to do with a crappy code base.
deathamal@reddit
Your take is a bad one sorry.
Code quality doesn't just mean one thing and it certainly isn't the same for every person, language or even project. You may prioritise consistency for example sometimes is at the cost of simplicity of one area of the code base over another. You may prioritise declarative code vs. procedural - for example use of abstractions for concepts may be more important to manage states than using lots of variables. Small functions may be important depending on the types of testing you need to do for your particular project/code base.
Maybe you prioritise readability, so you prefer strong types over more implicit / flexible / dynamic typing.
Code Quality is decided upon by the team working on the project - it is a set of agreed rules with many many trade offs in different ways. There are lots of principles which have been built up over time, but which ones matter or what is important varies.
Quick-Benjamin@reddit
I feel like you've used a lot of words to say not much?
Quality code is easy to understand. That seems to be the sum of your entire post?
Yeah. Groundbreaking.
Flashy-Whereas-3234@reddit
You put things in boxes. You label the boxes.
Boxes expect other boxes to do certain things. They don't mind how they do them, just that they do them.
Don't let boxes get too big. Consider putting delicate items in smaller boxes.
You can be certain what each box does individually. Some boxes are similar. Some boxes can be swapped.
You carry the cognitive load of the box. Sometimes you need to think about a few boxes. You will never be able to think about all the boxes at once.
What goes on in the box is none of my business providing the box isn't leaking.
SideburnsOfDoom@reddit
I think both absolutes are wrong:
"All code quality is subjective, nothing matters" is wrong.
And also "There's one objectively best way to do it, no room for opinions or preferences" is also wrong.
Yes, it is about clarity, Cognitive load, maintainability and related matters.
Legal-Trust5837@reddit
Code quality is subjective
gemengelage@reddit
It's not. Sure, when you compare 20 lines of code in one file to 20k lines of code in 100 files, one has an objectively lower cognitive load.
But when you compare 100 lines of code in one file with 50 lines of code in three files, which of them wins? But keep in mind, the lines aren't equally long. One of the solution uses inheritance, the other composition.
There's a secret third option that uses more lines of code, but it's rather imperative compared to the other two solutions. So while there are more lines of code, you can just read it top to bottom and have to keep fewer logical constructs in mind while reasoning about it.
Assume there's also the fourth option where someone turned our hypothetical problem into a code golf tournament and someone developed a very clever piece of python code that solves the whole issues in roughly 270 characters on a single line.
Which of these four options is the one that objectively has the smallest cognitive load? By which metric?
Dazzling_Trifle2472@reddit
Well that’s just like… your opinion man
JollyJoker3@reddit
Assuming the title is the main point of your post, you can create a benchmark for how much a coding agent needs to read to make a change in a code base. Just make it measurable instead of just arguing cognitive load isn't subjective.
Once you have a way to get numbers, you can explore what's actually quality code according to your metric.
james__jam@reddit
Curious, what does it say when you google about the topic?
cheir0n@reddit
properly he believes that the quality of Google search is not subjective. He will write his own web crawler and indexer.
california_snowhare@reddit
That is a lot of words to say code quality is about managing the growth of cognitive complexity
cheir0n@reddit
It is really irrelevant at this point when we use AI to generate the code.
And yes, code quality is subjective.
n4ke@reddit
I don't think "as simple as possible" is debatable, or debated for that matter.
What people often do debate is the chosen path to get there, of which there is not necessarily always only a single one.