Should Competent Programmers be "Mathematically Inclined"?

April Fools, right?

Math is totally required for programming.

Maybe you didn’t need to be formally educated in it, but you use mathematical principles all the time.

Graph Theory - invaluable for networks
Probability theory - you use this when making performance decisions. Maybe you do it intuitively but the concepts are the same.
Discrete Math - lots of problems in computer science are related to discrete math.

I’ve had to use math to prove things to management, such as the pigeonhole principle, which I used to explain to someone how hash codes do not contain as much information as the original data.

When you’re developing a business application some of the hard math is already done for you by the people who wrote the library code you use. But if you want to do multi-variable usability testing of your app you need to do statistical analysis. The same goes for fuzz testing or even unit-testing: you need to limit the size of your test yet still get meaningful results. That’s math.

I support Chris. With business/web development the hardest part is understanding your customer right. It’s much more interesting to understand universal mathematical properties that are valid forever and throughout the entire universe.

Although I won’t say math helps per se but in my case begin great at math has helped me greatly. Especially solving complex sets of equations. Thats essentially what programming is. Its one big complex equation. It may be constructed with some very simple pieces. The biggest problem I see is that those who aren’t that great in math don’t seem to see the big picture. How everything fits together. Some do eventually get there but it takes them much longer than those with a strong math background. But then again this is just what I have observed.

I think the ability to formulate your ideas clearly is the essential programming skill. Math is one discipline that forces you to do this; writing a five paragraph essay is another.

The essential skill I find a lot of programmers don’t possess is the ability to answer the question what does your program do? in one sentence.

Most programmers respond to the question by detailing HOW the program does what it does i.e. Well, first I build an array and populate it . . . blah blah blah. They can’t clearly say WHY the program exists i.e. The function calculates the final interest rate for a loan application.

Programming is structured communication.

I’ll second word problems and knowing enough to know where to look.

I have seen competent programmer with very low math skill, and vice versa, good math guys unable to write a simple piece of code.

Nevertheless my own experience still advocate for a strong correlation between the 2 topics. I love programming and used to practice a lot math some years ago, and I am still emotionned by a neat algebra theorem.

Every single programming hour, I can feel that relentlessly chasing the buggy case is very similar to me, than when trying to challenge with counter-examples a math demonstration to see why it is working and can’t fail. As math, programming is about caring about all details because any detail can make the entire edifice collapse.

Also an elegance piece of code might require some time to be fully understood. You then realize that any refactoring would make it worse. The same can be said from an elegant math demonstration. IMHO Programmers and Mathematicians are both looking for something elegant.

Beside this, I use some pure-math while coding NDepend, a lot of graph algorithm but also some tricky polynomial things, especially to increase performances and do some nice UI related things.

I really hope I’m not falling for a big April Fool’s Day troll. :slight_smile: In Stack Overflow podcast episode 39 you addressed the question: Do programmers really need to know math?, and your conclusion, in a word, was no. This blog post is a good follow-on to that discussuion. I hate to make a symantic argument, but I think your definition of math is too narrow. Fundamentally, all software is math and all math is software.

If the question were posed, Do all programmers really need to know calculus?, I would agree with you and say no. Likewise for trigenometry, geometry and plenty more obscure branches of math. However, I think it is very important that people realize that software is math. Everybody recognizes Quicksort as an algorithm, and therefore math. But your little if-then-else statement is also an algorithm. Every piece of software is an algoritm. Microsoft Word is an algoritm for translating clicks and keypresses into documents.

It may seem that I am quibbling, but this has profound public policiy implications - specifically around the patentability of software. At least one of the following three statements are false:

  1. Software is math.
  2. Math is not patentable.
  3. Software is sometimes patentable.

Right now, case law defines the second and third statements to be true. However, the first statement was proven to be true - mathematically - back in the 1930s with the lambda calculus. The statement software is math is true - not in the 3 out of 4 doctors agree way, but in the 3 + 1 = 4 way. No law can change that, in the same way that no law can redefine pi as equal to three. So what we are left with is bad case law.

The subset of math that they teach in math class does not overlap 100% with the subset of math that most developers employ daily. That might be a less effective sound bite than Programmers don’t need to know math, but as a programmer I like my statements to make mathematical sense. :slight_smile:

Re: Mastery of native tongue - Intelligence and dyslexia etc. aside, there’s a distinct correlation between grammatical ability and programming ability. Same brain wiring, IMHO. If you doesn’t do grammar good, you is having not many funs with syntax.

Re: pi = 4 - wasn’t that religionists pushing that through? (sure sounds like it - take the easy answer instead of leaving the difficult question open :slight_smile: )

There is an interesting article here http://www.maa.org/devlin/devlin_10_00.html about why math is good for programmers. The argument is basically that doing math teaches you to work with abstractions, something that is also needed when programming.

ìBut software engineering is all about abstraction. Every single concept, construct, and method is entirely abstract. Of course, it doesnít feel that way to most software engineers. But thatís my point. The main benefit they got from the mathematics they learned in school and at university was the experience of rigorous reasoning with purely abstract objects and structures.î

Math is just as much about proofs and logic as it is about pushing numbers around. Math is also about being able to look at a problem and select the appropriate tool from a very large toolbox in order to reduce or change the problem. You then select the next appropriate tool and iterate. Sounds like programming to me.

You’re missing the point Jeff.

Functional programming helps you, not because you’re writing functional programs, but because it helps you think differently.

Mathematics does the same thing.

P.S.: I bet that you use a lot of set theory when you’re writing Stack Overflow.

As a citizen of the great state of Indiana, yes, it’s true, we once localized pi (shame). Also, when I took AP physics in high school, we used 9.8m/s^2 for the acceleration due to gravity, but the non-AP kids used 10 because it was an easier calculation. I was going to mock them, but I just looked it up to make sure I was remembering it was 9.8, and I see it’s actually 9.80665 m/s^2 according to wikipedia. So I guess both groups localized it…

I am always looking for that mathematical insight that might help me create that elegant solution to some programming problem I am working on. It’s the same thing with programming puzzles. I am waiting for the day that I will have to sacrifice ten people to find out which one of my 1000 bottles of wine were poisoned. So it’s really all about making this information practical and useful.

I agree with Herik, it helps with abstractions.
But now that I work developing games it has helped in a bit more concrete way.

But my opnion is biased as I have a bachelor degree in applied math.

I agree that most programmers are smart enough to learn whatever math they need just in time to attack the problem at hand… But, what I’ve found several times is that there are many who are not willing to do that extra effort (even though they are able to)… And that’s what’s hard to deal with! But then again, most of them don’t fit the compentent programmers category you’ve specified in the post title!

Anyone who programmed Scheme or StandardML programming IS a type of applied math. A least for discrete values of math so to speak :wink:

Math is hard. Let’s go shopping!

Prediction:

Programmers who consider themselves good at math will proclaim that math skills are critical to being a good programmer.

Programmers who consider themselves not good at math will proclaim that math skills are irrelevant to being a good programmer.

Math is more than just numbers. There’s mathematical logic (for instance first order logic, from which most modern languages are derived); there’s discrete math (you know, that boolean logic stuff we somtimes use; or for analyzing algorithms); there’s set theory (a basic concept for most graphing problems, e.g. minimum spanning tree); there’s computability theory; etc. etc. etc. etc.

Yes, to be a good programmer you emdo/em need to be mathematically inclined. Or perhaps better put: to be a programmer who isn’t just doing the same repetitive CRUD operations in different forms all day, you need to be mathematically inclined.

There’s a lot of waxing poetic about how programming is more an art than a science, and resistance to calling programming (or computer science as a whole) a mathematically-based science. The fact is it emcan/em be both. The golden ratio is an incredibly important artistic notion, but has its basis in math. Just like emall/em the constructs of our field has its basis in math. There is still plenty of room for creativity, and you can approach it artistically for sure. But you can’t rightly treat programming as an Art until you’ve mastered the emmathematically based constructs/em: when you grok the mathematical and syntactical structure of a language, emthen/em you can start to be a artist. Not before.

So I would say that Dijkstra is correct.