Should Competent Programmers be "Mathematically Inclined"?

The one job where I really used some of the (multitude) maths from university was my first, where I worked with music DSP software. Apart from that, knowledge of boolean algebra is always useful and set theory applies to database design. I do however belive that studying mathematics developed my analythical skills, which I use every day.

Niyaz PK: I do not consider web development anywhere near REAL programming.

You must have missed this post: http://www.codinghorror.com/blog/archives/001216.html

I had to integrate a function once when writing some AI code. There wasn’t a lot of math in my part of the AI, or anything like that. The integrated function wasn’t too complicated once I worked it out.

I just needed to recognize that the quantity I needed was a cumulative value of a function over time – the area under a curve. If I didn’t have exposure to calculus, I don’t know how I would’ve recognized that fact or solved the problem.

Math is like any other systems science. Write enough code and you’re going to run across it.

Math is hard, let’s go shopping! http://www.codinghorror.com/blog/archives/001172.html

Sorry, just had to. :slight_smile:

What about every time you’ve needed to figure out the big O complexity of your code?

Do you work with recursive or dynamic algorithms? What about basic data structures like trees, hashtables, and heaps? You need math to be able to understand their running time and correctness.

Certainly, someone can put together a CRUD web application without understanding any computer science or math. However, the same person might not be able to hack:

  1. The basic data structures he uses.
  2. The database management system his data is stored in.
  3. The kernel
  4. The compiler or interpreter he uses for his programming language.

All of those things I listed have components that require some understanding of CS and math to grok. Parsers in programming languages are often implemented as a dynamic algorithm for instance…

Do you really count as a programmer if you don’t understand computers or algorithms, but can only program in a narrow domain that has no complexity?

I see maths as a metalanguage build on a natural language. Mathematicians redefine terms (tree, family, free, kernel, etc.) which have their mathematical meaning and relationships. it goes from simple redefinitions to complex theories.

On the other side, science (like physics) tries to modelize the world: it goes from complex to simple; which also helps the computer scientist (see domain driven design for example)

IMHO, mastering the math metalanguage as well as the physics modelling help the computer scientist.

Writing a plotting api [1] is a good example of where one might need some math. Trigonometry, Hermite curves, boundary calculation, etc.

[1] http://linil.wordpress.com/2008/09/16/cairoplot-11/

Programmers don’t need to be mathimatically inclined, but they also shouldn’t be adverse to math. When a programmer tells me they’re not into something (like math) I think that’s a shame. I can’t relate to them anymore. Why exclude a whole block of subject matter b/c you’re not interested in it or afraid you won’t be good at it. You said we should constantly be learning, that includes math, it excludes nothing.

Math at the very least trains analytical thinking and problem solving. Most of the, I change that, all of the great programmers that I’ve worked with were really good at math.

if we’re going to talk about math, let’s get out of the abstract and into the specific. Let’s talk details. Examples. What could be more math-y than that?

Yeah, what Jeremy said about this, except that I’m not certain you don’t know what you’re talking about… it could be just a slip of the tongue.

Out of curiosity, are you really familiar with upper-level mathematics? I hope so, because otherwise you are writing a review of a tool you have never used.

It is the other way around today.

Should competent mathematicians be above average programmers?

What code have I personally written where a detailed knowledge of math made your work easier? I had to fit sensor response curves into an insanely small eprom, so I had to create a multi-segmented Taylor series algorithm as a mechanism to fit the curves and develop the coefficients…just for instance. Web jockeys that are throwing textual data around might not have much math to do, but all of us scientific and engineering programmers sure do. I once spent 2 months playing with Mathmatica trying to come up with an approach to a programming problem. And what about game programmers? They eat trig for breakfast, I’d imagine.

I remember that when we have learnt Gaussian elimination at school, I was absolutely convinced that I never ever would use that in my future life again - OK, then I didn’t know yet that I would make my living as a computer programmer. Then, at a web (!!!) development job many years ago, I had a complicated 3x3 system of linear equations, remembered the algorithm, but not the name - it was with classic.asp, and I solved the system by hand. The result was 2-3 screen pages of algebra and dozends of pseudo unit tests verifying the intermediate formulas (some of them failing due to rounding problems) - but the software worked. Later, I discovered that there exists software called CAS or computer algebra system.

Now I’m working on an asp.net intranet web app at another company, and I had a hard time trying to convince my boss that a linear equation with boundary value constraints for some variables is not linear no more and cannot easily be solved for another variable. I ended up with a mixed solution, partially algebraically solved, partially with an iterative approximate solution. The dissent remains, but as long as the results are OK, there’s no point in going through the profoundities of implementing inequality solvers (no, things like that don’t exist at all in the sooo cool .net library).

What sometimes drives my crazy is the absolute impossibility to explain the unsettling primitivity of the so modern state-of-the-art best-of-all-worlds .NET framework (using C#) with regard e.g. to linear algebra (I must admit that I have studied computational linguistics at university where we have learnt Prolog) to most of todays programmers. They even claim that a function returning a delegate is a function returning a function (Ever heard of C pointers? Yes, that existed in ancient history. Delegates are sooo much better, really the ultimative thing!). These are the people which will never grasp what a CAS is for, which never have seen the beauty and usability of 4GL KI languages like Lisp and Prolog (#8222;These are only for scientific purposes!#8220;).

But that’s why I always was the programmer who was charged with those programming tasks these people couldn’t accomplish at my former job (which I left for differen reasons).

@dbasnett I think you are starting to get to the nub of the issue. The biggest math nuts I have ever know were impossibly awkward when it came to real life problems.

I suspect that the proposition needs to be reversed. While mathematicians may claim logic as their own, applied logic (and common sense) is, I suggest, the lingua franca of all the great programmers/system developers.

Mathematical skills are too often equated to a very limited set of capabilities, far short in my mind of the skills required to be a truely great programmer.

Even programmer is, in my world view, not what we are talking about. We are talking about people who can enter chaos, see patterns where others see noise, and then reduce their understanding to an algorithm - or implementation - that a machine can repeatedly perform for the benefit of others.

There is nothing inherit in that process that requires specific mathematical ability (although it may, in certain domains). The core is logic and pure reasoning ability.

Which is why - and I offer myself as a great example - we find programmers who are effectively multi-lingual in many programming languages, but struggle with even one additional human language. Programming languages are in effect just subtle variations of an expression of distilled, pure logic, whereas human language is in only the most superficial sense logical.

I love human language, and always wish I spoke many more than I do; but in learning languages, and leaning programming, I recognise the two share nothing other than the vulgar use of the word language.

I agree that COMPETENT programmers don’t need to be mathematically inclined, however, one will never be a skilled* programmer without great math skills.

  • read: able to code efficient and robust software.

How else would you (just a few examples):

  • Put several controls in a UI container and move around them in columns and rows on a resize.
  • Update the hue or color on a progress bar or other mechanism depending on status.
  • Use user selection on an array of items to affect bit-type flags using 2 to the Nth power.

Sure, you can use conditional statements or other mechanisms for this, but then it’s neither efficient to update and sometimes to run, nor is it robust: i.e. doesn’t require logic code changes to update.

In short, math over conditionals or other similar mechanisms doesn’t require the logic to be updated when expanded. Use these lesser methods and you will be competent. Use math, and similar forward thinking approaches, and you will be skilled and your software will be smoother, sleeker, and easier to update.

Mathematically inclined is not to be confused with knows math.

By mathematically inclined Dijkstra meant having the kind of intelligence that would allow one to do well at math if one had the need or desire to do so. Not because one needs to learn math to do programming, but because one needs the same kind of intelligence.

The thought processes involved in constructing a mathematical proof are similar to those involved in constructing a program; the thought processes involved in finding the flaw in a proof are similar to those used for finding the bug in a program. The same thought processes used in polishing a proof to make it more elegant are used in refactoring a program to make it simpler and easier to understand and modify. The same thought processes used in learning a mathematical notation are used in learning a programming language or API.

Programmers maybe, but what about configuration managers or such?

The Dijkstra quote is that programmers should be mathematically inclined. I think the point was not that they be know a lot of math or even that they like math, but that they are the sort of people that, if motivated, are good at learning and understanding math.

I just noticed Frank made the same point above… ::sigh::…

There is such a strong disagreement about terms, and no one’s mentioned it.

If you’re talking about basic arithmetic, sure. Everyone needs a fundamental understanding of the stuff. If you’re working on a computer, a decent understanding of binary representation / operations (and a very good understanding of floating-point limitations) is helpful.

But the real help, for me, was several years of abstract math PROOF courses, the ones that are usually for math majors. That is where you see proofs, written in english (or whatever, but not foolish symbols/code), in set theory, group theory, graph theory, measure theory, and so on. It is where you deal with the first examples of complexity (is a countable infinite set, such as the integers, the same size as an uncountable infinite set, such as the real numbers? Proof that no one-to-one mapping exists between the two.), transformation of a problem into a smaller or already-solved problem (… which reduces to the lemma we already know is true, so we know the problem we’re trying to solve is proven, also.)

The years of work with this, build some basic intuition and also give you useful tools.

I was given a nasty programming task, one that looked like weeks of work on an ill-specified set of requirements that were guaranteed to change. Worse, it was a financial application in which a mistake could result in lawsuits. (There was a guarantee that, post-implementation, the customer would change the requirements.)

How to do this, without truly shoddy, bug-ridden code? It turns out that all of their special case requirements could be translated to a problem dealing with equivalence classes in sets, and the robustness of the solution could be traced to the robustness of the translation of the problem. A proof in one area translated to a correctness assertion in the design for the code. Implementing the code itself was an hour using a simple table-driven code, easing maintenance.

When they changed the requirements post-installation, with more special cases, the engineer installing the code needed to add a couple of entries to a table and restart the application. He charged them a lot of money to do it, too. :slight_smile:

Math skills are usually an interface problem.

In China, they’re taught symbols as concepts early. In the USA, Europe and other English speaking countries, this doesn’t happen until far later (usually in math class) and it’s a big leap.

How hard would the concept behind a summation symbol be to you if it had been first introduced to it at the age of 6?

Frankly, most math concepts are, in and of themselves, pretty trivial. The barrier to entry is all those pretty greek symbols with meaningful spatial positioning. If you’re not taught to think with symbols early, you probably never will.