Overfitting in design

When looking at design comps it’s easy to get led along a happy path. Designers have incentives to make design comps look good—they are selling work after all—and that means that every module is probably going to have the amount of content it just so happens to look best with, especially when presenting to clients. Usually this is fine! But there are times when it makes a design brittle, a situation I call overfitting.

This word is, of course, stolen from statistics, for when you’ve fit a model too exactly to your training data for it to generalize to data it hasn’t seen. The concept is just the same in design: an overfit design is one that’s too dependent on a certain shape of the content, such that it falls down when you give it something else.

Learning to recognize this in the design stage is important, because it’s cheaper and easier to fix a problem the earlier you spot it. You don’t want to be dealing with it in implementation, and you really don’t want it to first crop up in production.

When does overfitting arise?

A big difference between web and print design is that you’re designing something dynamic vs. static—you don’t always know what shape your design is going to take. For makers of design systems, it’s even worse; you don’t even know what content people are going to put into your designs.

Because of all this, a design can be overfit along many different variables:

Not everything is overfitting. In the real world, a designer’s time is finite and thus any given design is only going to respond gracefully to a certain amount of content. It’s not overfitting if the range of content it can handle is a reasonable one!

Ultimately, too, you’ve got to consider where your content is coming from. A design that’s fit to a very certain amount of content might be workable if that content is coming from a person who can see how it looks in context and adjust accordingly (so-called “curated” content). But when the source of the content is automated, and the designer doesn’t know how much to expect, there you want to watch out.

Designs can’t specify everything. If they did, it’d be implementation. Part of a developer’s job, when working on frontend, is to have enough of an eye for design that you can fill in the inevitable gaps without having to go back to the designer for every little detail.

Avoiding overfitting

Here is where it really helps to consider the grain of your materials and how to work with them. In a web browser, content flows vertically, and is constrained horizontally. (Unless you’re doing a horizontally-scrolling webpage, in which case, please don’t.) That is to say, you can always add more content as long as it flows downward. Content can naturally shrink and stretch in that dimension. Vertical space lets your content flow like water.

In contrast, you need to carefully control for content that can grow horizontally (for example, the length of a word in a header, or the number of tabs in a navigation bar.) Remember that the amount of horizontal space you have is not predetermined, either!

An interesting tension between vertical and horizontal space pops up when side-by-side elements are expected to be the same height, for example, in a grid. Once you’ve done so, you’re capping the amount of text that can go into the elements, so you need some way of automatically truncating it.

With media, consider the art direction of the images that you expect to live in your components. Can there be text, or not? Can there be faces? How “busy” can the image be? Is it a background, or foreground, or potentially either? All this ought to be written down in your design system, or your design system’s users will endlessly surprise you.