Declarative design
Tags: declarative, design, imperative, tools
Published: 2022-04-30 07:28:13

---
title: Declarative design
published: true
date: 2022-04-14 16:21:51 UTC
tags: declarative,design,imperative,tools
canonical_url: https://adactio.com/journal/18982
---

I feel like in the past few years there’s been a number of web design approaches that share a similar mindset. [Intrinsic web design](https://www.youtube.com/watch?v=AMPKmh98XLY) by Jen; [Every Layout](https://every-layout.dev/) by Andy and Heydon; [Utopia](https://utopia.fyi/) by Trys and James.

To some extent, their strengths lie in technological advances in CSS: flexbox, grid, calc, and so on. But more importantly, they share an approach. They all focus on creating the right _inputs_ rather than trying to control every possible _output_. Leave the final calculations for those outputs to the browser—that’s what computers are good at.

As [Andy](https://set.studio/) puts it:

> Be the browser’s mentor, not its micromanager.

Reflecting on Utopia’s approach, [Jim Nielsen wrote](https://blog.jim-nielsen.com/2022/exerting-control-with-media-queries/):

> We say CSS is “declarative”, but the more and more I write breakpoints to accommodate all the different ways a design can change across the viewport spectrum, the more I feel like I’m writing imperative code. **At what quantity does a set of declarative rules begin to look like imperative instructions?**
> 
> In contrast, one of the principles of Utopia is to be declarative and “describe what is to be done rather than command how to do it”. This approach declares a set of rules such that you could pick any viewport width and, using a formula, derive what the type size and spacing would be at that size.

Declarative! Maybe that’s the word I’ve been looking for to describe the commonalities between Utopia, Every Layout, and intrinsic web design.

So if declarative design is a thing, does that also mean imperative design is also a thing? And what might the tools and technologies for imperative design look like?

I think that [Tailwind](https://tailwindcss.com/) might be a good example of an imperative design tool. It’s _only_ about the specific outputs. Systematic thinking is actively discouraged; instead you say exactly what you want the final pixels on the screen to be.

I’m not saying that declarative tools—like Utopia—are right and that imperative tools—like Tailwind—are wrong. As always, it depends. In this case, it depends on the mindset you have.

If you agree with this statement, you should probably use an imperative design tool:

> CSS is broken and I want my tools to work around the way CSS has been designed.

But if you agree with this statement, you should probably use a declarative design tool:

> CSS is awesome and I want my tools to amplify the way that CSS had been designed.

If you agree with the first statement but you then try using a declarative tool like Utopia or Every Layout, you will probably have a bad time. You’ll probably hate it. You may declare the tool to be “bad”.

Likewise if you agree with the second statement but you then try using an imperative tool like Tailwind, you will probably have a bad time. You’ll probably hate it. You may declare the tool to be “bad”.

It all depends on whether the philosophy behind the tool matches your own philosophy. If those philosophies match up, then using the tool will be productive and that tool will act as an amplifier—a bicycle for the mind. But if the philosophy of the tool _doesn’t_ match your own philosophy, then you will be fighting the tool at every step—it will slow you down.

Knowing that this spectrum exists between declarative tools and imperative tools can help you when you’re [evaluating technology](https://adactio.com/articles/12839). You can assess whether a web design tool is being marketed on the premise that CSS is broken or on the premise that CSS is awesome.

I wonder whether your path into web design and development might also factor into which end of the spectrum you’d identify with. Like, if your background is in declarative languages like HTML and CSS, maybe intrisic web design really resonates. But if your background is in imperative languages like JavaScript, perhaps Tailwind makes more sense to you.

Again, there’s no right or wrong here. This is about matching the right tool to the right mindset.

Personally, the declarative design approach fits me like a glove. It feels like it’s in the tradition of John’s [<cite>A Dao Of Web Design<cite></cite></cite>](https://alistapart.com/article/dao/) or Ethan’s [<cite>Responsive Web Design</cite>](https://alistapart.com/article/responsive-web-design/)—ways of working with [the grain of the web](https://frankchimero.com/blog/2015/the-webs-grain/).