Skip to main content

Constraints are good πŸ”—

It is easy to think that creativity requires great freedom, but the opposite is often true.

A chain link giving thumbs up.

I first heard the phrase “constraints are good” at a tech conference in 2010. I don’t remember who said it, but it has stuck with me ever since.

When I first heard those words, they sounded rather odd. “Constraint” is a negative word to me, so intuitively I want to remove constraints. Why would they be good?

Creativity benefits from constraints #

While it may sound counter-intuitive, creativity often benefits from constraints. They help us to avoid getting lost in the infinite space of possibilities. They help us to focus on what is important. It can even be a source of inspiration. As the saying goes, “necessity is the mother of invention”.

A photographer who chooses to only use black and white film is constrained in a way that a photographer who uses color film is not. But that constraint can help the photographer to focus on the composition and the light, rather than the colors.

Well-chosen constraints can also help reduce decision fatigue. When you don’t have to make a decision, you can focus on the things that matter. This is one of the reasons you often read that successful people wear the same clothes every day, or eat the same breakfast every day. It is not because they don’t care about what they wear or eat, but because they want to save their decision-making energy for the things that matter.

Avoiding undesirable outcomes #

Constraints can also help us in other ways. Software development is different from many other disciplines because we can build virtually anything. We are not limited by the laws of physics nor the laws of man (most of the time anyway). The medium with which we work is infinitely malleable. This is both a blessing and a curse. Because that “anything” which we can build includes not only the great things we envision, but also all the bad things which we sometimes produce.

Since the possibilities are endless, in theory nothing prevents us from creating something truly great. But nothing prevents us from creating something really bad either. By adding wisely chosen constraints, we can eliminate many of the undesirable outcomes. Even if we screw up a bit, we’re likely to create something which is at least acceptable.

Smoke detector regulations #

When building a house there are regulations saying that you need to install smoke detectors. In fact, the regulation will likely even say how many smoke detectors you need given how large the building is. (At least that is the case in Sweden, where I live.) This is a constraint which limits the options of the builder. But it is also a constraint which we as a society has found to be beneficial. Through hard-earned experience, one might add. It is a constraint which will help us build safer houses and save lives.

In software engineering, we have few such constraints. Depending on the business you are in you may have some regulatory requirements, but they are often quite narrow. Software engineering is still very young as a discipline, and this is one of the areas where it shows. We have not yet formalized the “number of smoke detectors” kind of constraints for software engineering. The closest thing we have are various “best practices”, but they are very far from being universally accepted. Not only automated tests are mandatory!

Actively adding constraints #

Because constraints are often beneficial, it may make sense to actively create them. In my mind, that is one of the key goals of software architecture. To intentionally limit your freedom in the moment to reach a higher goal in the end.

Steve McConnell puts it like this in his classic book “Code Complete”:

Some creative programmers view the discipline of standards and conventions as stifling to their creativity. The opposite is true. Can you imagine a website on which each page used different fonts, colors, text alignment, graphics styles, and navigation clues? The effect would be chaotic, not creative. Without standards and conventions on large projects, project completion itself is impossible. Creativity isn’t even imaginable. Don’t waste your creativity on things that don’t matter. Establish conventions in non-critical areas so that you can focus your creative energies in the places that count.

Conclusion #

I think constraints are good. While it may sound counter-intuitive, they help us focus on what is important. They help us avoid undesirable outcomes. They help us to be creative.

What constraints can you add to help you focus on the things that matter?