DEV Community

Cover image for Improving code using the Trinity of Quality
Nick
Nick

Posted on

Improving code using the Trinity of Quality

I watched this YouTube video recently by Minute Physics (who I highly recommend subscribing to) on the Trinity of Quality, a concept I had not heard of before, but I think it maps directly onto something I think about most days: how to improve the quality of mine and my teams code.

The Trinity of Quality according to Henry Reich (the creator of Minute Physics) is a triangle, made up of three corners:

  • Quality: How good something actually is
  • Taste: How good you think something should be
  • Discernment: How well you can determine Quality

I'll briefly talk about what these mean in more detail, but I suggest you watch the video for a more in depth look at each of the corners.

Quality

How good is the thing your looking at? This can be both objective or subjective. The quality of your code is made up of a multitude of different factors, some of these are very objective: do you have a syntax error, will this function pass it's unit tests, is it even possible to test the code? Some are less subjective: how whitespace has been used, how granular functions are, the naming of variables.

Taste

Or preference. This is a personal viewpoint about the Quality of something. Are you a code perfectionist, do you think all of the metrics that define code quality should be at their highest or do you care more about the function of the code? If it does what it needs to do and passes all it's unit tests, who cares what it looks like under the hood?

So Quality is how good something is on a scale, while Taste is where we think it should be:

Image description

Focusing just on how to make something is good is where we usually go when trying to improve our code. But the problem with this is that there is a more useful skill: How good are you at determining how good something is?

Discernment

This is the most under-looked, but potentially the most important corner of the Trinity. If Quality is where your code is on a scale and Taste is where you want it to be, then Discernment is how good you are at being able to determine how good your code is, it's your error bars on your code checking skills. If they are wide, then even if we have high standards (Taste) we wont necessarily be able to determine if our code meets those or we might think that it has even when it hasn't:

Image description

While there are plenty of rules of thumb or even best practices for how good our code is, these don't always work and sometimes we don't really know why code is good.

Someone who is more discerning than me who has the same Taste (or preference or standards) might deem my code not to of high enough quality to meet their taste:

Image description

Being more discerning as software developers allows us to be better judges on both on how good our own code is, but also on other people's code when we do code reviews.

Taste and Discernment are linked but are not the same. Training yourself to be more discerning might lead you to change your Taste, but there's always an underlying truth, so improving ability to Discern the Quality of code is an important skill. In the video, Henry describes a number of ways that differing discernment between people can lead to issues when working together with others. Not to mention that being more discerning in general should improve your code Quality, how can you improve if you aren't able to reliably measure that?

There are ways to improve your discernment, here are some tips you can apply:

  1. Give yourself time to do code reviews, don't rush them.
  2. Speak to others, don't do your code reviews in isolation
  3. Try to concentrate on objective, rather than subjective Qualities when reviewing code.
  4. Conduct your own code reviews, do this regularly throughout your development cycle.

But overall, I think it's just important when reviewing your code or others, to remember the Trinity of Quality. Is the reason you don't feel someone's code is of the correct Quality because of your Taste (or standards) or is it because you aren't be discerning enough to know?

Cover art by John Schnobrich.

Top comments (0)