Math vs programming (part III)

In which I react to some of the comments on my “Who needs code samples?” post.

Rather than quoting people, I will reply to some of the general ideas outlined in the comments. After this post, it’s case closed; this whole discussion has taken up way too much energy and time already.

Sample code contains implementation details, while formulas deal with the abstract concept (rather than a specific implementation).
No disagreement there. It would have been better if the book had given both formulas and example code. In an ideal situation, it would also have tried to abstract away some concepts (data storage, etc), or at least separate them from the actual algorithm. OTOH, this might not always have been possible, as performance is an issue as well.

Suggestions to look at SICM:
I have looked at this book before, but gave up on it before long. One of the reasons might have been the abudance of formulas; another is that I am not particularly interested in physics.

Competent programmers know how to read these formulas. Computer science is programming. Reading math formulas is a useful skill for programmers. You need a degree in CS to be a good programmer. (etc)
Here I refer to my previous posts about the relevance of math in everyday programming tasks.

The formulas described in the original article are not particularly difficult.
Probably, but they still require context to read them. In short: ||v1-v2|| requires that you know what v1 and v2 are, what || stands for, what subtraction means in this context. By contrast, vector1 – vector2 is a bit longer, but much clearer. My point is that I neither need nor want to know the context to read these particular formulas, because they have no relevance to my work.

Strong anti-math sentiment:
I believe this is related to the fact that some people love to shoehorn programming into the mathematics branch. It just doesn’t belong there; the math needed and taught in CS courses has little relevance to the real world (hence the vast numbers of CS graduates that are unprepared for a real programming job). This causes resentment.

In my case, there are other reasons why I object very strongly to the notion of “math is a requirement to be a programmer”. In fact, when I was ~16, I wanted to become a programmer, so studying computer science seemed a logical step; then was told that you needed to be good at math. This struck me as odd, since I had been tinkering with programming and it required very little math, but hey, people must know what they’re talking about, right? So I went on to do something else, keeping on programming as a hobby. I sold some of my homebrew programs. No math required. Eventually I landed a job as a programmer. Still no math required. That was 10 years ago; in the meantime I’ve written all kinds of software, very few of which need any advanced math.

This notion (“you need to be good at math to be a programmer”) almost stopped me from realizing my dream. I figured it must have stopped others as well, and still does, so I will do everything I can to fight this myth.

Formulas are a great way to express abstract concepts; their notation is really just another “language” one needs to learn.
This is true, but I’m unsure if learning this “language” will benefit me much (other than saving me from the scorn of Reddit readers ;-). Aside from that, the notation has problems… but that’s a different story.

Code examples in Haskell:
Haskell is interesting, but it does strike me as math notation disguised as a programming language. It suffers from some of the same problems: conciseness to the point of being unreadable, and little usefulness in the real world. That said, maybe someday I will make a serious attempt at learning it properly.

:::

All this discussion has distracted from the fact that I don’t hate math, and am not particularly bad at it either. I just would prefer code samples in many cases. That’s all. I’m now going back to my coding. :-)

5 Comments

  1. James said,

    June 3, 2008 @ 1:25 pm

    Man – I’ve been there. Reddit seems to attract a type of programmer who believes math is some kind of special thing. It makes some people feel like they are in a special club with a special language only they share.

    To merely suggest that there are other forms to communicate ideas that are logical without using the most concise mathematics (or programming language) is admitting you aren’t part of their club. To suggest one can be as effective using these methods as one can be using math and math-like notation is insulting or something.

    Now, I go further and suggest that the broader appeal of languages like Python make them better than mathematical notation. The very fact they are not as concise as math makes them easier for people to learn. People can and do make incredible things with these languages without having to understand heavy math.

    So I am with you. And despite the myopic obtuseness of a vocal few programmers from Reddit, you will find that the majority of professional programmers are with you too.

  2. Carlos Perilla said,

    June 3, 2008 @ 9:30 pm

    It was fun to see the thread, good job stirring the pot.

    I’m with James that most professional programmers would be with you. Nowadays programming has found a place in lots and lots of new fields and it seems that there are plenty of areas where a strong mathematical background is not as necessary as it was not so long ago. Personally I see this as a good thing.

  3. Nes said,

    June 4, 2008 @ 10:07 am

    To add insult to injury most math courses are geared towards continuous math, the type used in physics (i.e. calculus) which is hardly ever used in programming (that is unless you are doing physics simulations). Maybe this just happens at the place I studied, but I had a hard time motivating myself to learn for the two calculus classes required for my CS degree because it was never explained to us what all these exercises in derivation and integration were good for and I was never able to take any physics class in my life. Ten years later I have started to find places were calculus might be useful but I can hardly remember any of the math anymore. I would have preferred they had taught us more about set theory, boolean algebra, combinatorics and probability. It seem those topics are “uninteresting” to math teachers but in programming we mostly deal with arbitrary discrete objects (e.g. the red toaster, the blue toaster, the bread, the butter, the margarine) and not some neat continuum of space and time.

  4. rgz said,

    June 5, 2008 @ 8:46 am

    Haskell is however, unambiguous, since a computer has to execute it, traditional math notation went bonkers beyond nth root and function application notation.

    I still think Javascript would have been a better choice if popularity was important.

  5. Hans Nowak said,

    June 5, 2008 @ 8:52 am

    @rgz: Javascript is still mostly used in browsers, though (in spite of all the talk about it being the Next Big Language)… that would make it somewhat less useful for the examples in this book.

RSS feed for comments on this post