Understandable-Simple vs. Minimal-Simple Code

Published on October 6, 2017 (↻ September 20, 2023), filed under (RSS feed).

Code simplicity seems to be a goal quite worthwhile, contributing to better understanding, greater robustness, and higher quality. That’s at least what comes to my mind when looking at the matter.

When drafting my new short book on CSS optimization I thought that even though the blurriness of the term “simple” seems quite tolerable, there may at least be one important differentiation to make. And I noted, reworded for this post, that:

Making code simpler is an important optimization goal. Alas, that goal of code simplicity is often a disguised goal of code minimalism, and simplicity and minimalism don’t necessarily correlate—they don’t correlate in the case of shorthands, indeed not, but they do when we speak about character minimization as part of production optimization.

And yet, the goal of simplicity, just seen as one, is important: Optimizing for simplicity appears to make code more understandable and our work easier, and it seems to challenge ourselves as craftsmen to only use the least amount of code possible.

But what does that mean?

I believe that the omission of optional tags can serve as a good example. I swear on it—except for this site (because, reasons) I omit optional tags and unneeded attribute quotes wherever I can—but some react so strongly about this practice that optional tags allergy seems quite in the league of bee and nuts allergies.

But what’s really happening here?

The most minimal XHTML document is this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Foo</title>
  </head>
  <body>
    <p>Bar</p>
  </body>
</html>

When we switch the DOCTYPE to living HTML, we get:

<!DOCTYPE html>
<html>
  <head>
    <title>Foo</title>
  </head>
  <body>
    <p>Bar</p>
  </body>
</html>

And when we omit everything not needed, we get something I once called “the World’s best HTML template”:

<!DOCTYPE html>
<title>Foo</title>
<p>Bar

What do we observe? I’d say we notice simplification. With each step our code got simpler.

But in what way? That is where I believe we can make out a difference in terms of understandability and minimalism. The code got more minimal, or more minimal-simple. But did the code get more understandable, too? In my mind yes, but this question seems not as easy to answer as whether the code became more minimal, and so I believe the code may not necessarily have become more understandable-simple. (Especially not when recalling many a heated reaction and debate around the omission of optional tags and other characters.)

Is there a difference? What is it worth? What can we take away from this? I believe there is a relevant difference that can influence some of our development, code management, and team leadership decisions, but here now, I wish to share the observation with you to wonder about your own thoughts. What do you make out of understandable-simple and minimal-simple?

Toot about this?

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for companies like Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma. I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (where applicable) or a message.