Understandable-Simple vs. Minimal-Simple Code
Post from October 6, 2017 (↻ June 2, 2021), filed under Web Development.
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?
I’m Jens Oliver Meiert, and I’m an engineering manager and author. I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.
If you have questions or suggestions about what I write, please leave a comment (if available) or a message.
Have a look at the most popular posts, possibly including:
Perhaps my most comprehensive book: The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Google Play Books, and Leanpub.
Looking for a way to comment? Comments have been disabled, unfortunately.