A115 Logo Dark A115 Logo Light

A115 is a London-based consultancy helping fast-growing businesses and scale-ups build sophisticated on-prem or cloud-based technology platforms when code quality matters.

We specialise in rapidly building, securing and scaling cloud-native greenfield platforms to add new capabilities or expand into new markets. With over 20 years' experience productionising experimental code and complex systems, A115 provides end-to-end services - from initial architecture and infrastructure design through development, deployment and maintenance. Leveraging expertise across industries and technologies like Python, SQL, AWS and Azure, A115 enables clients to launch innovative products faster while ensuring robustness, resilience and regulatory compliance.

A115

Training and Consulting

Bookmark this page and check again soon for our personalised individual or team training packages and offers!

London, United Kingdom (HQ)

contact@a115.co.uk
Python Training

Book review: The Joy of Abstraction

A Software Engineer's Guide to Category Theory

Eugenia Cheng's popular book "The Joy of Abstraction" explores the world of abstract mathematics and category theory. While seemingly esoteric, this branch of math has very relevant applications in software engineering, especially in designing complex systems. This review breaks down the key concepts, links them to coding principles, and shows why math still matters for modern programmers.

Intuition Before Formalism: Building an Abstract Frame of Mind

Mathematics often conjures up images of endless formulas and rigid analytical thinking. Yet in The Joy of Abstraction, Eugenia Cheng shows how math can be creative, visual, and grounded in real world examples. She wants to guide readers to think more abstractly before diving into technical formalisms.

This approach mirrors how we build software systems. As programmers, we leverage layers of abstraction to manage complexity. We use interfaces, wrappers, and pipelines to create modular components. The implementation details are abstracted away behind clean APIs.

Cheng encourages mathematically reluctant readers to approach category theory in this spirit. Category theory provides a framework for modeling relationships and transformations at a high level, separate from the specific objects involved. Similarly in coding, we deal with data structures and functions abstractly, not worrying about their specific runtime values.

So before delving into advanced math, Cheng develops the reader's intuitions. She relates abstract concepts to social issues and everyday experiences that software engineers recognize. This "outside-in" teaching style creates an inclusive on-ramp to mathematical thinking. Once readers accumulate the right mental models, the formal technical matter becomes much more accessible.

Relationships Over Objects: Understanding Connectivity

Once readers have developed an abstract frame of mind, Cheng dives deeper into category theory. At its core, category theory studies connections between objects rather than the objects themselves. This aligns with how we build modular software systems.

In coding, objects have behaviors and relationships that enable flexibility. For example, Python classes inherit behavior from parent classes. Changes to the parent class interface automatically apply across child classes. This connectivity allows code reuse and decomposition into logical units.

Cheng uses the metaphor of guests at a party to illustrate this principle. The party forms a category where guests are objects. But the interesting structure comes from relationships - conversations between guests. We can transform one conversation into another by adding or removing guests.

Likewise in programming, we leverage relationships to transform data flows. An API call wraps underlying database access. A GUI view renders model data for display. We compose streams of map/filter operations to transform data.

By focusing on connections rather than isolated objects, category theory provides insight into building extensible software systems. Components interconnect via simple rules, enabling modular architectures.

Composing and Decomposing: Modularity and Reuse

A key benefit of category theory is understanding how to decompose and recombine components. In software, we aim to build systems from reusable parts that "plug and play" well together.

Cheng relates this to real-world experiences using her concept of "mathematical knitting." Just as knitters create garments by repeating stitching patterns, mathematicians compose systems by applying rules systematically.

In coding, functions and classes act as stitching patterns that transform data flows. We combine them into pipelines, executing each function's logic serially. Alternately, we build class inheritance chains that share common logic.

This modularity enables solving big problems by reduction into simpler pieces. We break down domain logic into services by business capability. We divide monoliths into microservices by workload. This aligns with category theory's focus on understanding relationships between components.

The flexible recombination also supports reuse and maintenance. We isolate components via clean interfaces and rigourous testing. Changes localize to specific services rather than rippling across a tangled architecture. By judiciously decomposing and composing modules, we sustain long-term agility.

Abstraction in Action: Applications for Software Engineers

While category theory may seem far removed from day-to-day programming, its core concepts profoundly influence software design. Principles like abstraction, modular architecture, and component reuse derive from mathematical analysis of connectivity and transformations.

Some direct applications of category theory include:

  • Functional programming languages like Haskell use abstractions like monads and functors to chain operations.
  • Stream processing frameworks leverage category theory insights on composability and state.
  • Domain-driven design approaches model complex business capabilities as interrelated domains rather than technical components.
  • Database normalization applies category theoretic ideas like abstraction and modularity.
  • Type theory ensures program correctness by formally specifying component interfaces.

So while not all programmers need to deeply study category theory, we benefit indirectly from best practices it inspires. By teaching core mathematical ideas in an intuitive style, Cheng's book provides software engineers a pathway to enhance their coding with abstract thinking.

Learning category theory doesn't instantly make you a better coder. But expanding your mathematical maturity and embracing abstraction gives you deeper insight into building evolvable systems. Just as math is more than rote formulas, quality software is more than hacking together what "just works." By taking the time to understand foundational concepts, we become more thoughtful, creative architects.

Going deeper: Sets for Mathematics

In an earlier book review we introduced the textbook "Sets for Mathematics".

Both "Sets for Mathematics" and Eugenia Cheng's "The Joy of Abstraction" aim to provide intuitive pathways for readers to access advanced mathematical concepts. However, while Cheng focuses specifically on category theory, "Sets for Mathematics" builds foundations starting from set theory and categorical algebra more broadly.

The two books complement each other in helping software engineers strengthen their mathematical maturity. Cheng's writing style and real-world examples make the abstract ideas more accessible. "Sets for Mathematics" offers rigor in formalizing these concepts into precise specifications and theorems.

Both books emphasize mathematical abstraction not as an end in itself, but as a tool to solve problems in the real world.

Together, these books illustrate the relevance of foundational math to software engineering. Concepts like modularity, composability, and logical reasoning have direct applications in analyzing complex software systems. Studying the underlying category theory and set theory builds intuitions that lead to better system design.

With more than 20 years experience consulting some of the fastest growing brands in the UK and globally, the founder of A115 has a no-nonsense educational approach to modern enterprise software engineering.

Categories
Python Training
5
Bespoke Software
0
Code quality
1
Case Studies
1
Tools
1
Industry Insights
2

Subscribe to the A115 weekly newsletter!

By subscribing you agree to our Privacy Policy