Math every day

Steve Yegge wrote (and writes, again) about interesting stuff. Two of my favorite essays are written by him. One is about Compilers and why you should know them, the other about why it's important that programmers learn mathematics. Read them both to better understand where I come from.

I came to the conclusion that saying mathematics has nothing to do with programming, is like saying programming and software contain no patterns or structure.

For me this means I get a little bit happier everytime I understand a bit more mathematics, or when I read some essay or see a video that explains how they used understanding of mathematics in writing a piece of software.

It also explains why I get a little less happy when I have to write another piece of database code, error-checking code for forms or controllers that have every bit of functionality spelled out. Computers are smarter than that. And we should be, too.

My new found optimism comes from two papers that I read in the last two weeks. In the first paper, Notes for the Programming course at Adobe, Alex Stepanov writes:

If traditional mathematics deals with sets of values and operations on them, value algebras, we have to deal with sets of locations and operations on them: location algebras.

This helps us understand how we can see mathematics together with the use of pointers. A pointer is a location. Stepanov talks about how iterators are an abstraction of location, and how you write general algorithms for sorting and searching on top of these abstraction, without knowing which data structure is used underneath.

In this second paper about Regular Expressions, Fischer, Huch and Wilke show how their regular expression algorithms can be abstracted over semirings (a mathematical structure). In practice this means you can use the semiring { S = { False, True }, zero = False, one = True, â=â¨, â=â§ } to find out if a regex matches and the semiring of non-negative integers { S=N0, zero = 0, one = 1, â=+, â=â } to find the number of times a regex matches for a particular string. Another semiring finds the leftmost position of a match. These are all practical applications of abstract mathematical concepts.

I think that we can become better programmers, if we better understand what mathematics is. Patterns are hiding in our code and we don't even know it. Mathematics will help us discover these patterns.

Mentions

Welcome

My name is Peter Stuifzand. You're reading my personal website.

Profiles

Peter Stuifzand
peter@peterstuifzand.nl
Zwolle, The Netherlands