Jens Oliver Meiert

Code in Quarantine

Post from March 31, 2021 (↻ July 25, 2021), filed under .

In the current second paradigm of web development, we often work with components and have a 1:1 relationship of HTML to CSS *.

This component-based 1:1 approach looks like it makes maintenance more predictable. That is, fewer stools seem to fall over in other bars. However, it doesn’t solve—but rather pronounces —the problem of rarely used code.

To keep an eye on new and rarely used code, it can be useful to put it in quarantine. The Little Book of HTML/CSS Frameworks (2015, German edition 2019) describes the background:

[…] new and rarely used patterns are a challenge that runs in the best families. There tends to always be a need for something new, and there are always document types or elements that are used infrequently. They’re one of the biggest contributing factors to code bloat. They are hard to control if they don’t get watched and reigned in vigorously.

Though I could give a longer dissertation about the matter, an effective counter-practice is to either designate style sheet and script sections for new and experimental code, as well as rare elements—or to even put aside a separate style sheet and script for such purposes. The framework developers should anticipate this and make recommendations, but users should come up with their own guidelines if this piece has not been covered. A documented standard for new code allows better monitoring and better decisions on whether to keep (and relocate) the code, or to remove it.

What does this mean? What is code in quarantine?

Code in quarantine is code visibly marked as experimental, in test, or defective. 

From here on, quick thoughts:

What Code to Put Under Quarantine

What code would you actually quarantine?

How to Mark Code in Quarantine

There are several approaches to quarantining code:

How to Proceed with Code in Quarantine

Finally, you can go about quarantined code in various ways:

❧ In small projects, we often know code well enough to avoid quarantining portions of it. To-do comments may be enough to keep an eye on them. In larger projects, it’s easier to lose track of anything that is or could be a problem. Here, having a model that goes beyond to-do comments is useful.

The ideas above have helped some of the projects I’ve worked on. What helped yours? What did you observe?

When kingdoms totter and thrones tremble, when battles are fought and people everywhere are acting important, it is quite possible that some people get overlooked.

Figure: Let’s make sure quarantine code doesn’t feel like that, either. (Copyright King Features Syndicate, Inc., distr. Bulls.)

* This is an artificial relationship that avoids some but leads to other code duplication. Still, it works for many developers.

How would the problem of code duplication be pronounced? Many components may contain the same declarations. These may then not be normalized anymore, that is, be merged as CSS rules. (If we were talking about the first paradigm, this would have led to the recommendation to vigorously DRY all CSS.)

Quarantine code is actually different from “shame” code, though that label may come off stronger than was intended.

Tweet this? (If it changed your life, you delight me with a coffee.)

About Me

Jens Oliver Meiert, on April 29, 2020.

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.

Read More

Have a look at the most popular posts, possibly including:

Cover: The Web Development Glossary.

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.

Stay up-to-date? Follow me by feed or on Twitter.

Looking for a way to comment? Comments have been disabled, unfortunately.

Found a mistake? Email me, jens@meiert.com.

You are here: HomeArchive2021 → Code in Quarantine

Last update: July 25, 2021

Professional frontend developers produce valid HTML and CSS.