The Intersection of Mathematics & Code: Decomposing Abstract Problems
How studying algebraic structures and formal proofs helped me write cleaner APIs, design resilient DB schemas, and think from first principles.
How studying algebraic structures and formal proofs helped me write cleaner APIs, design resilient DB schemas, and think from first principles.
As a Mathematics student, I spent a lot of my first year learning to write rigorous mathematical proofs. In abstract algebra, you learn that you cannot assume *anything* that has not been explicitly proven. Every step must follow logically from the axioms.
When I started teaching myself web development, I realized that writing code is essentially the same thing: constructing a proof using code.
In mathematics, sets are collections of distinct elements. When modeling database collections, particularly in NoSQL like MongoDB, you are defining mathematical relationships (one-to-many, many-to-many). For instance:
If you can decompose a mathematical statement into lemmas, you can decompose a complex backend process into clean, isolated controller files. In Express.js, writing middleware functions is the equivalent of composing functions:
Where $g(x)$ checks auth status, and $f(x)$ handles the request logic. Keeping them pure and decoupled ensures that your code is predictable and easily testable.
Self-teaching coding alongside a mathematics degree has made me less reliant on boilerplate copy-pasting. When a bug occurs in a MERN stack application, I don't just change variables randomly. I isolate the problem space, state my hypotheses, and check the logs. This analytical mindset has saved me hundreds of hours of debugging.
Showaib Hossain
Mathematics Honors & MERN Developer