Poll: What level of math is programming roughly analogous to?

233 points by shawndumas ↗ HN
My son is writing moble apps using Objective-C and is around 11. My question is if arithmetic is 1 and advanced calculus is 10 at about what cognitive level is bog standard, journeymen, CRUD programming in Objective-C?

(Please remember that voting does not up vote the poll.)

164 comments

[ 1.9 ms ] story [ 211 ms ] thread
What type of programming, what paradigm, at what scale, and dozens of other questions... I can think of numerous areas where each of these is not only "analogous", but directly used.

  - Want to even think of committing to scalaz/haskell? Category theory
  and lambda calculus.

  - Want to develop a physics engine for a modern 3d shooter?
  Geometry, trig, single/mutli-variable calc, algebra, and differential equations.

  - Want to do some NLP? Discrete math, automata theory,
  not to mention a strong background in linguistics.

  - Want to do some ML? Bayes statistics.

  - And so on..
I've always been amazed by how little is needed to squeak by in some scenarios and also how much is needed to do truly amazing things. The more you learn and push, the more you realize you don't know.

Edit: This was prior to OP clarification. :)

(comment deleted)
You can pick up all the Category theory (and Lambda Calculus) you need for Haskell from Haskell alone. (Of course, it doesn't hurt to know more. But it's not necessary for a newbie.)
I'm not sure I understand the question.

Programming can be a mix of many things: reasoning about associations and state, designing processes or interfaces, or—most saliently—modeling a domain that may or may not mathematical in nature.

To compare a programming language/runtime with a US math curriculum makes about as much sense to me as asking for the Richter magnitude of a sledgehammer.

The poll didn't make sense to me either until I read what he was actually asking for:

>what cognitive level is bog standard, journeymen, CRUD programming in Objective-C?

He should probably have clarified it in the title

Programming can require many things, but the OP specifically asks about this:

> bog standard, journeymen, CRUD programming

What do you think are the cognitive demands of that task, however defined?

Then the answer is "it depends". You can program at a level with a cognitive demand on par with Algebra (however defined), and you can program at the level of Complex Analysis. There's no one-to-one map between the two.

Just like math, you can go as deep into a programming language or concept as your mind will carry you so there's no equivalence relation.

Yes, but I'm also skeptical of the idea that some math subjects are cognitively more intense than others.

The "cognitive load" or whatever is really just a function of how much you've practiced and internalized that area of math. Calculus builds on algebra, sure, but once you've internalized algebra you don't have to "think real hard about algebra" _while_ you "think real hard about calculus."

Running a 10k for the first time is not the same as running your first 5k twice.

As someone who studied math as an undergrad, I completely agree. As far as I can remember, Learning the Fundamental Theorem of Galois Theory was no more difficult to me than learning the Mean Value Theorem.

But I guess my point is that programming at an "Algebra" level means you have very little knowledge the language, while programming at a "Calculus" level means that you have much more knowledge.

Why even use the words "algebra" and "calculus", then? Why not use "8th grade" and "12th grade"?
I have always found geometry to be the most similar in terms of content. Geometry is where most people are introduced to proofs, which are similar in a lot of ways to programming. Also, you often need to know some amount of geometry in even CRUD apps to properly deal with interfaces, charts, etc.

That said, I spend 90% of my time writing geometric analysis libraries, so I am biased.

I like this analogy. When I hear someone compare programming to math I assume that they mean what I would mean if I were to say it. Specifically, their similarities lie in the realm of logic.

Some programming problems require specific areas of mathematics, some others, some none at all. All programming, as well as all real mathematics, require the ability to reason logically about a problem.

Based upon this understanding, I can't chose any of the poll options, but if I had to, I'd go with geometric proofs as well.

For Objective-C (or any objective language): geometry. Qualities of objects, and their role in relation to other objects are really all there is.

Also, memory, which is all we are manipulating at the end of the day, is linear; points on a line.

the time series for RANDOM ACCESS MEMORY is far from anything resembling linearity. Nor is a snapshot of it at any point in time usually.

RAM is equivalent of "tape" in a Turing machine. If its anything resembling linear for any amount of time, the machine would not be Turing complete ... and therefore a not very interesting programming language/model.

Ah, apparently I do not fully understand the hardware implementation.

Consistent, in software at least, is the concept of memory being linear; references using a start and end point, and points between.

You can get by with an "algebra" level understanding of programming.

However, concepts such as recursion, and other metaprogramming don't really make sense at that level.

You can make rote crud apps with an algebra level understanding of programming.

I understand recursion and metaprogramming, I'm pretty poor on algebra.

When it comes to deep level programming concepts, debugging complex apps - working on hard performance issues, I have no problem.

I think OP was using math as a scalar metaphor for programming.

In that vein, I'm not saying you need to literally know algebra, just that it's a parallel kind of progress.

The point being that if you know algebra well, you can do useful things with math. In a similar vein, if you know functions well, you can do useful things with programming.

Geometry proofs
No. This is wrong.

The correct answer is abstract (modern) algebra.

I have a slight problem with the question. Math is used when programming or creating models, but both are tools. I find it hard to compare the two in the way you're asking, so I think this poll is bogus. Programming requires abstract thinking as does math at the algebra level and beyond (more so at the calculus level and beyond). Other than asking what level of math is required to program X, it's hard to ask what cognitive level quantified by mathematical ability is required because cognitive levels both aren't easily quantifiable and also don't directly correlate with mathematical ability. There are lots of ways to do the same thing.

As for me, I have taken math to the level of Differential Equations and Linear Algebra.

Despite what others are saying. This is a very good question. And extremely relevant.

The answer depends on how great you want to become. Take as much math as possible to find the best solutions. I come from a background of the hard sciences, I never took programming in college and I was able to pick it up quite easily because of my strong foundation in mathematics, analytics and logic.

I agree 100% it is relevant.

I would put it into these terms, however, for simplification.

Coding simple programs is probably analogous to algebra/functional logic.

Having a 3-D model of workflow process with escalation loaded into your mind when you're working on an architecture is more akin to calculus. Add User Experience and network requirements into the mix and the skill is more akin to writing an Overture and the Opera. At this point you have a different animal than described above.

I have seen it said that mathematicians break down into analyst types (calculus) and algebraist types (algebra). The difference in approach is usually described along the lines of "in analysis, you have an object under study and you want to describe how it behaves in some sort of limit condition. You have a mental model of the problem and you work to formalize what your intuition tells you" vs "in algebra, you have an object under study and a set of rules. You apply the rules in a mechanical manner until you produce an interesting-looking (or desired beforehand) result".

Under such a worldview, my personal view of the mental requirements of a simple CRUD type of task is that the ability to apply definite rules called for in the "algebraist" approach is closest (and extremely necessary). I've read many comments that beginning programmers can have a hard time understanding that the computer will do exactly what you tell it to do, and nothing else; applying algebraic rules is a very similar concept.

Geometry is an unpopular choice in your poll, but I think it has some of the same flavor of recognizing that "by labeling this complicated term 'x' and this other complicated term 'y', we can transform the current state of the problem into exactly the preconditions for theorem T" that I'm thinking of.

Anyway, overall I vote for algebra 1.

roughly around algebra.

programming has an "advantage" over math in that you can just program something and see what happens and therefore gain an intuition and craft your way around things. mathematics is much more deprived in this respect, for a variety of reasons.

overall i would describe programming as a precise form of writing, whereas math is a very pure science

The description is clear, but the title of the poll wasn't.

Note that if you're doing game development, a higher level of math will be required, than if you're writing a crud application that talks to an api; in the latter, understanding linguistics and a good common sense are more important.

You will (probably) never pull out pencil and paper and do arithmetic (simple, with fractions, averaging, etc.), simplify an algebraic expression, convert to standard form, factor a quadratic, solve a system of linear equations, calculate the area of a polygon, prove something about triangles, solve an inequality, divide polynomials, take the slope of a line, etc. This is what "math" consists of in K12 and very little of it is obviously linked to programming itself.

You don't need any of high school math unless your specific application requires it (i.e. graphics involves polygons, anything quantitative involves arithmetic and unit conversion, you may want to report percentages and averages at some point.)

Things I remember from K12 math classes that were useful for programming in general:

- What variables are

- What functions are

- You can compose functions (this was obvious because I had been programming for 5+ years before function composition was introduced)

- Very basic set theory (Python list comprehensions resemble set-builder notation)

- Introductory propositional logic (though I learned this in the context of programming 7 years before I was "ready" for it in math class)

Learning to prove things about triangles (geometry) exercises some of the same skills as programming, but I wouldn't say it teaches them. Certainly none of the theorems or facts have ever been useful, just the process of reasoning.

Python also supports set operations (union, intersect, difference, issubset, issuperset, etc.). So set theory will help in that regard, too.
True, but the operations you just listed are intuitive. It certainly doesn't take a math class or pencil-and-paper practice to know how to use them.
Disclosure: I am a mathematics teacher. (I teach prealgebra to elementary-age pupils.) I am NOT a programmer. But I think the correct answer to the question is "it depends." In other words, even though you have specified a level of programming, "bog standard, journeymen, CRUD programming in Objective-C," and even though you have laid out the usual progression through the usual school mathematics topics in the English-speaking world, you haven't given enough information to match the levels.

Some people program insightfully, or so I am told by people who program, and other people program nothing but kludges. Among mathematics learners, there are great variations in the levels of "profound understanding of fundamental mathematics" (PUFM) among people who are studying the "same" level of mathematics. It interested me that you mentioned neither number theory nor combinatorics among your list of secondary mathematics courses, because in some other countries, those courses would come well before calculus. In general, any reader of Hacker News could learn a lot about what is missing in the United States (or, more generally, in the English-speaking world) in elementary mathematics instruction by reading Knowing and Teaching Elementary Mathematics: Teachers' Understanding of Fundamental Mathematics in China and the United States by Liping Ma.[1] There is a lot to basic mathematics that is far from easy, if deep understanding is what you are looking for. In the countries that excel over the United States in mathematics instruction, proof is part of every mathematics course, not just part of geometry, for example.

[1] http://www.amazon.com/Knowing-Teaching-Elementary-Mathematic...

> In the countries that excel over the United States in mathematics instruction, proof is part of every mathematics course, not just part of geometry, for example.

There's room to wonder about how much of a causative role this has, and how much it reflects consumer demand. When my sister started taking algebra, my parents asked me to help her, and I was careful to provide proofs of all the algebraic properties of exponents (e.g. x^m * x^n = x^{m+n}; x^0 = 1; like that). That's not usual in the US, and didn't feature in her textbooks or supplements, but I did it basically just because it was important to me.

> In the countries that excel over the United States in mathematics instruction, proof is part of every mathematics course, not just part of geometry, for example.

Can you expand on that? What do students do in other mathematical areas if they don't do proofs? I did all of my studies in France and I don't how much of a difference there is (though all my friends who have studied both in the US and in France found the maths classes a lot easier in the US).

What do students do in other mathematical areas if they don't do proofs?

The book I already mentioned, Knowing and Teaching Elementary Mathematics, will give much of the sad story. A really sad description of how mathematics textbooks are written in the United States[1] and a contrasting description of what kinds of problems are found in Russian textbooks[2] fill in more details.

It was on my second stay overseas (1998-2001), that I became especially aware of differences in primary mathematics education. I discovered that the textbooks used in Singapore, Taiwan (and some neighboring countries) are far better designed than mathematics textbooks in the United States. (During that same stay in Taiwan, I had access to the samples United States textbooks in the storeroom of a school for expatriates, but they were never of any use to my family. I pored over those and was appalled at how poorly designed those textbooks were.) I discovered that the mathematics gap between the United States and the top countries of the world was, if anything, deeper and wider than the second-language gap.

Now I put instructional methodologies to the test by teaching supplemental mathematics courses to elementary-age pupils willing to take on a prealgebra-level course at that age. My pupils' families come from multiple countries in Asia, Europe, Africa, and the Caribbean Islands. (Oh, families from all over the United States also enroll in my classes. See my user profile for more specifics.) Simply by benefit of a better-designed set of instructional materials (formerly English translations of Russian textbooks, with reference to the Singapore textbooks, and now the Prealgebra textbook from the Art of Problem Solving),[3] the pupils in my classes can make big jumps in mathematics level (as verified by various standardized tests they take in their schools of regular enrollment, and by their participation in the AMC mathematics tests) and gains in confidence and delight in solving unfamiliar problems. More schools in the United States could do this, if only they would.

[1] http://open.salon.com/blog/annie_keeghan/2012/02/17/afraid_o...

[2] http://www.de.ufpe.br/~toom/travel/sweden05/WP-SWEDEN-NEW.pd...

[3] http://www.artofproblemsolving.com/Store/viewitem.php?item=p...

US math courses for high schoolers often goes along the following path: Algebra, Geometry, Algebra II (basic linear algebra, but often not discussed as such, and other concepts), Trigonometry, Precalculus (1/2 semester each of the last two) and then Calculus. Of course, that adds up to 5 years so unless a student took Algebra I in middle school (year 8) they won't complete the full sequence, leaving calculus for college (depending on major).

The structure of formal proofs is taught in geometry. That's pretty much the only course where students are expected to prove theorems about the subject via proofs. In most of the other courses students are taught the formulas and techniques, axioms and theorems, but then apply them, rather than attempt to develop or prove them themselves. They're also, typically, not shown a proof of the theorems they learn, they're just told to accept them.

> The structure of formal proofs is taught in geometry. That's pretty much the only course where students are expected to prove theorems about the subject via proofs. In most of the other courses students are taught the formulas and techniques, axioms and theorems, but then apply them, rather than attempt to develop or prove them themselves. They're also, typically, not shown a proof of the theorems they learn, they're just told to accept them.

Wow! I can't even imagine how that works. When I went to school (and that's in Europe, not Asia), the notions of theorem and proof were taught in the fifth year of school (out of 12 pre-college years -- 8 in elementary, 4 in high school). That was, indeed, as part of geometry. Starting from high school, however, pretty much no formula is given without prior demonstration. Subjects where they can't do that (like mechanics -- that's taught in Physics prior to pre-calculus and calculus) are a royal fuckup. You aren't usually expected to be able to reproduce the proofs for those formulae, but a) you're strongly encouraged to study them, because they help you with the exercises and b) it's usually implied that, if you can't remember the formula, but you can prove it, it's OK. For example, if you can't finish a problem in a test because you don't know the formula, but you obviously try to find it, the professor will sometimes give you full credit, depending on circumstances and following a short talk.

I didn't even like math back then, save for geometry, but I reckon this was the most important thing I learned there. Unless you're dumber than a toaster, you're typically able to apply what you learned to everyday phenomenae after ten years of school; the bonus you get is also being able to reason rigorously and correctly, which is an important takeaway no matter what path you choose to follow.

> being able to reason rigorously and correctly

At whatever level of Math (or any subject) you develop this skill, you are ready to be a programmer.

When I took a maths GCSE, (UK qual,) most of the work was memorising equations and using them. You didn't prove them or understand how they worked or anything. Like teaching someone to program by memorising the functions in the standard library.
Under the new "Common Core" standards for mathematics in the US, there's a lot more emphasis on proof in elementary-school mathematics than there was before. The terminology is usually more along the lines of "explain your reasoning", but the process is definitely proof-oriented. (Whether teachers will be able to incorporate those standards into their teaching, and whether students can live up to them, remains to be seen.)

Disclosure: I'm a full-time tutor for third and fourth grade mathematics in the inner city through the Denver Math Fellows program ( http://www.teachindenver.com/teachindenver/denver-fellows-pr... ).

I wrote a driving game in C about that age and the hardest thing to figure out was vectors and sin/cos-stuff (you have to separate speed and direction even in a simple driving game) so I guess the programming part is easier than that. Although it's just hard because I didn't know about those concepts at that time. And of course, the code was very simple.
I voted for discrete mathematics for two reasons:

(1) It has relatively few pre-requisites in comparison to advanced calculus (which I'm assuming means something like a first course in real analysis).

(2) It isn't rote. There's more creative thought involved in solving problems. Even high school calculus is often extremely rote. I think programming is rarely rote, even if it's just a CRUD app. You have to strategize about how to approach the overall architecture of the program and make predictions about how early design decisions will affect future extensibility and more.

It's listed as the most advanced course though. I pretty much would agree with you, but this poll is too illogical.
> It [discrete math] has relatively few pre-requisites in comparison to advanced calculus (which I'm assuming means something like a first course in real analysis).

My first course in real analysis didn't have much in the way of prerequisites at all. I loved it because everything was covered ground up (including concepts like "limit").

While that might technically be true on some level, ask yourself if the average student would do well if they started with Rudin's Principles of Mathematical Analysis in 11th or 12th grade having taken absolutely no calculus prior to it.

There's a reason most universities require students to have completed the entire calculus sequence and often even a special "introduction to proofs" class before exposing them to a book like Rudin's.

I think programming actually requires linguistic skills. When you program you are actually writing in a language, and you have to respect it's syntax and structure.

Therefore I don't think it should be compared with math. Unless you are writing a program for a very specific scientific problem that requires the elaboration of a mathematical model.

Usually the computer does all the math, all you need to do is type the operations you need it to calculate.

I'm not saying they're completely unrelated, I just think linguistic skills are more relevant in most cases

This goes to the heart of the real issue. Programming is expression, more linguistic then maths. What would a lisp program with heavy macro usage map to? Or a newLisp program with fexprs? The programming concepts are abstractions and transformations more akin to how we change words meaning then how you calculate some lines.
It's not.

There are certain levels of math or logic needed for various programming tasks, but it is not 'analogous' to any level.

For example, function composition is very useful in programming and thus Algebra (or was it Algebra 2???) comes in handy for understanding that at a basic level.

However, if you're doing graphics programming, then you often need experience with geometry (composition of basic shapes to form more complicated shapes, linear algebra (matrix operations), and modern algebra (quaternions).

I use a bit of trig to do graphics programming but that's about as much Math as I've used when programming.
Algebra: Functions, variables, and manipulation of basic data structures.

I learned programming before I learned how to manipulate variables in math, and my prior knowledge helped me figure out how to deal with most of algebra.

Just yesterday I decided to begin reading a Calculus book (I never went to college). The very first thing covered was ƒ(x) which describes input being passed into a function. Needless to say, as a programmer I am very familiar with this concept.

So far, my vote is for Calculus.

In my high school, I remember being introduced to functions of that type in Algebra II and at the very latest trigonometry (sines and cosines).

While a knowledge of functions is vital to understanding Calculus (the fundamental theorem of calculus depends on them), it's only a small component of the bigger picture. Calculus is mainly about how functions change with respect to some other variable (time is common) and the inverse of that operation.

As a game designer, i'd say Physics, algebra, geometry come in VERY handy. Now, i am not familiar with how these topics are taught in the US system, but assuming your options are a progression, i'd say pre-calculus should do it.

Similar to your son, I have been programming since an yearly age. We had Macromedia Flash back then, and over the course of my academic life, as i progressed in the Mathematics courses, my programming capabilities increased with leaps and bounds. For example, the movement in my games was usually similar to Pacman or bomberman. No arcs, or curved paths existed. As i learned about 2D motion, i started making Platformers. As i learned trigonometry, I started making games involving curved paths on a 2d plane. Even a realistic Car game. i remember coming home from high school the day they taught us about "Radians" and began usign the sin, cos, tan funtions of ActionScript (because the documentation said it used Radians and that never made sense to me before). It was that very year i programmed game AI that would chase the player in a realistic way.

So yeah, math helps

I wouldn't look it that way. Programming is an art which aims to solve any problem in any domain using logical reasoning and systematic application of solutions that requires to solve the problem. Or even build a whole new thing.

Given that, programming is everything and anything. Which is why a good programmer would always focus on the problem not the knowledge required to solve the problem. Because if you embark on tough project, find solutions is essentially like making a discovery.

In my opinion you shouldn't ever first learn books(apart from the very basic ones) and then go in search of problems. The right approach is to look for problems, and while solving them and you can learn the knowledge required to solve those problems as you go along.

Programming is analogous to nearly everything in math. Programming is only a tool, which you can use to solve various problems around yourself modeled in some mathematical form(In short everything).

Which is why programming is the most awesome profession ever. Because by nature it lets you probe and grok the nature, working and science behind everything. That is why programmers are so good at problem identification, solution design and problem solving in general.