DEV Community

Cover image for Colour, Color, and the Contract Nobody Wrote Down
Jonathan Gordon
Jonathan Gordon

Posted on

Colour, Color, and the Contract Nobody Wrote Down

Every codebase runs on a contract based on naming.

A token called "color-primary" in code and a variable called "color/primary" in a design file are the same decision, expressed twice. The name is the only thing connecting them. Not the value because values change constantly. The name is the binding.


So: which gate in your pipeline checks names?

Compilers check syntax, type systems check shape, linters check style, and tests check behavior. Four independent gates, and between them they catch a startling range of mistakes, but none check what you call things. A function named solveColourToLuminance compiles, type-checks, passes lint, passes CI, and ships. Every gate is satisfied because vocabulary isn't a category any of them reason about.

That was tolerable when humans did the naming. Humans are boringly consistent. One person spells things the same way for a decade.

It's not tolerable now. AI writes an enormous share of the naming in a modern codebase: variables, functions, comments, token names, layer names, the vocabulary a design system uses to describe itself. And language models carry a spelling register out of their training data that nobody chose.

Fun fact: I had the following happen to me, and now I am convinced that there's a failure mode out there that's completely off the radar:

An AI assistant writes "colour" in a comment (who knows why). Nobody notices (I didn't); it's a comment. Next week it's a variable. Then a test name. Then a token name, and now you have naming drift between colour/primary in the design file and color-primary in the code. It's the same decision with no link between them and nothing errors or fails. The binding is just quietly gone. Review won't catch it either, and one en-gb (or en-us for that matter) spelling in a comment is harmless, so a reviewer is right to ignore it. But accumulation of drift like this does matter. So does catching it early.

Spelling is probably the easiest version of drift (let's call it "naming drift") to picture. Two things meant to be the same are visibly different. The same mechanism applies to any convention that lives in language. Static analysis reads structure, but it doesn't read vocabulary. And the contract holding design and code together is written entirely in vocabulary.

Food for thought (and production-ready coding).

Don't code in the dark. Be the human in control (instead of the human in the loop).

Top comments (0)