Applied category theory

Category theory can be very useful, but you don’t use it the same way you use other kinds of math. You can apply optimization theory, for example, by noticing that a problem has a certain form, and therefore a certain algorithm will converge to a solution. Applications of category theory are usually more subtle. You’re not likely to quote some theorem from category theory that finishes off a problem the way the selecting an optimization algorithm does.

Categorical thinking may be more useful than category theory per se. Someone with a categorical mindset can help you find symmetries, or inconsistencies, or other kinds of patterns that might otherwise go unnoticed. After the patterns are found, the category theory may go way. In fact, it may never have been explicit. For that reason, category theory may be a sort of unsung hero: when it works best, it may not call attention to itself.

When I first saw category theory, it seemed mysterious and fascinating. It said that some of the similarities I’d seen were more than vague analogies, but actually instances of something that could be precisely formulated. But soon category theory went from fascinating to frustrating, obfuscating rather than clarifying. I grew disgusted with it and didn’t want to look at it again. Over a course of years, I’d see some application of category theory and my original fascination would return, but soon so would the frustration. I’d put category theory out of my mind until the cycle repeated later.

After several cycles of fascination and frustration, I decided to dig into category theory. The turning point was a conversation with Erik Meijer. He told me how categorical thinking guided him in designing LINQ, and explained how category theory brings out a simple relationship between various kinds of databases. The diagram below comes from a paper he wrote on this. It turns out that so-called No-SQL databases are in a categorical sense co-SQL databases.

This was the first time I’d heard of category theory guiding practical discoveries, not just being used after the fact to restate ideas in more abstract terms, and that gave me sufficient motivation to dig deeper.

I had been skeptical of applications of category theory, and frankly I still am. Many reported applications of category theory aren’t that applied, and they’re not so much applications as post hoc glosses.

At the same time, I’ve seen real applications of categories, such as the design of LINQ mentioned above. I’ve been a part of projects where we used category theory to guide mathematical modeling and software development. Category theory can spot inconsistencies and errors similar to the way dimensional analysis does in engineering, or type checking in software development. It can help you ask the right questions. It can guide you to including the right things, and leaving the right things out.

Category theory isn’t the solution to life, the universe, and everything. It’s a tool, like dimensional analysis and type checking. Or maybe aerial reconnaissance is a better analogy. Sometimes it’s extremely useful to have a 10,000 ft view of a situation. But an aerial view won’t solve anything by itself unless it guides the hard work on the ground.

If you’re interested in how categorical ideas could help your business, let’s talk.

Work together