Programming Is Not Math

When I learned to program, back when dinosaurs walked the earth and the internet had no cats, there was an idea: if you were good at math, you’d be good at programming. I was great at math as a kid, but perhaps because I didn’t like it much, no one steered me towards programming. I came to it accidentally, in college, when I took an elective programming class because it fit my schedule.

So my first programming language was Fortran, an abbreviation of “Formula Translation.” As you might expect from the name, the projects in the class were exciting things like estimating the area under a curve using rectangles, like you see in the diagram below.

The Riemann Sum.

The Riemann Sum. Thanks to H.J. Keisler.

Doing Riemann sums in Fortran is about as math-oriented an introduction to programming as you can get.

And I loved it. SO MUCH!

That same quarter, I was taking my first Japanese class. Towards the end of the term, when I was getting ready to change my major to computer science because PROGRAMMING FUCK YEAH, I thought briefly about how similar the two classes felt. In both cases, I was coming into a culture I didn’t understand or feel part of. I was learning the mechanics of communicating, while at the same time trying to gain enough cultural knowledge to feel at ease.

But I knew – and everyone knew – that programming was like math. So clearly, I was good at Fortran because I was good at math.

Now, almost twenty years later,

I’ve changed my mind.

It started when I graduated, became a software engineer, and discovered that the vast majority of developer jobs only required middle-school math at the most. I had to keep a bit of math handy to do whiteboard interviews, but once I was on the job, my ability to communicate both with computers and with other humans was much more important.

I figured, at the time, that my jobs were the exceptions. Surely most programming was way more about math. I just, uh,…didn’t see those jobs. Even on the job boards. And my friends didn’t seem to have them, either…but oh well.

Then after I’d been working about ten years, I started teaching new people to program in my free time. I taught Ruby on Rails, which is a web programming framework; people came because they wanted to learn how to make websites. Because of those motivations, the curriculum had virtually no math.

And this is what finally did for it me. The students I saw – all adults – came from a wide range of backgrounds. People with a math background did fine, of course, but people with a heavy language background often did better. I saw this curious effect again when I started working with high schoolers, with a similar curriculum. Bilingual kids often took to programming more easily than monolingual kids.

I thought back to college, to my jobs, to my friends’ jobs, teaching…and I finally figured it out. Programming is not math.

Programming is Language.

Specifically, learning to program is more like learning a new language than it is like doing math problems. And the experience of programming today, in industry, is more about language than it is about math.

And my next thought, of course, was why doesn’t anyone else think this? Why do we still have this idea that math skills indicate programming potential, while language skills mean you should go into poli sci?

Well, when I feel out of my depth, I usually start by looking for “official” opinions. So I looked for relevant academic research.

WTF ACADEMIA

I found absolutely none, which is pretty flabbergasting. I found a lot of opinions, both from computer science educators, and from people in industry. Perhaps within academia, the link between math and programming is considered such an obvious truth that it isn’t worth confirming with research.

It seems more likely, though, that this research exists, but not under the search terms I tried. Please let me know if you are aware of relevant papers.

In the meantime, if we can’t have data, we can at least examine the conversations people have on this topic. Here are some things people often say when asserting that people must be good at math to be good developers.

Generally, they fall into three categories:

1. “You need to know math to be a good programmer.”
2. “You need to learn math to get the skills you need for programming.”
3. “Plenty of programming is still math!”

Let’s look at them one at a time.

1. You need to know math…

1A. …because computer science comes from math.

This is true. Academically speaking, most computer science departments trace their lineage to the mathematics department. Many computer science degrees are still very math-heavy. Mine certainly was.

However, as many other people have noted, computer science is not programming. At most academic CS schools, the explicit intent is that students learn programming as a byproduct of learning CS. Programming itself is seen as rather pedestrian, a sort of exercise left to the reader.

For actual developer jobs, by contrast, the two main skills you need these days are programming and communication. So while CS still does have strong ties to math, the ties between CS and programming are more tenuous. You might be able to say that math skills are required for computer science success, but you can’t necessarily say that they’re required for developer success.

1B. …because without a mathematical foundation, you’ll have only a surface understanding of programming.

A common variation on this: without a CS degree, you can’t build anything substantial. Which, ha ha! Don’t tell the venture capitalists! They’re down there on Sand Hill Road giving actual money to hundreds of people building software projects without any formal qualifications whatsoever. In fact, they do it so often that the college-dropout-turned-genius-programmer is our primary Silicon Valley archetype of success. And monetarily, their strategy seems be to working out for them, if the fleets of Teslas on 280 are any indication.

Back here in the real world, I have found little connection between a person’s formal qualifications and the depth of their understanding. As an example, consider whiteboard interview staple big-O notation.

If you took a dynamic methods class in school, you know that big-O notation is pretty much meaningless in the real world. Which is to say, it doesn’t matter how an algorithm operates on an arbitrary set of data. The only thing that matters is how it operates on your set of data. An algorithm that is O(n**2) for arbitrary data may actually be constant time (meaning O(1)) on your particular data, and thus faster than an algorithm that is O(nlogn) no matter what data you give it.

There are some interesting mathematical ways to model this, but weirdly enough, the people with CS degrees conducting whiteboard interviews never seem to be too interested. Go figure.

So, if you don’t actually need to know math to be a successful developer, perhaps instead the very act of learning it primes you to think the right way?…

2. You need to learn math…

2A. …because it teaches abstract problem solving, which you need to be good at programming.

Abstract thinking is absolutely a skill that every developer needs to hone. In fact, some people say that finding the right level of abstraction for a concept in your code is the root of all hard problems in software.

It is also quite true that you can learn abstract thinking by studying math. At last year’s GoGaRuCo conference, Daniela Wellisz, a developer with a background in math, did a fascinating talk on how programming is similar to doing proofs in math. I recommend watching it if you’re interested in the topic.

However, just because you can learn abstract thinking via mathematics doesn’t mean there is no other way. Learning a new human language is another way to develop that skill. Coming to understand concepts that are literally impossible to express in your native language is pretty damn abstract. When we learn a second language, the way we re-organize concepts based on a higher level of abstraction is structurally quite similar to how we re-organize concepts when we learn to think mathematically.

So while math is one way to learn to think about abstraction, it is not the only way.

2B. …because programming based on the mathematical concepts of logic.

Indeed, programming is often concerned with logic. But the same logical concepts are embedded in our human languages. Math is just a formalization of the concepts we use every day when we construct sentences and communicate with other humans. The best writers and speakers understand that, and can construct logical statements in human language that are easy for other people to evaluate. Sometimes they even change people’s minds about things.

Mathematical logic is a notation for concepts we already know, and it is the concepts – rather than the notations – that are important.

So if you don’t need to know math to be a developer, and you don’t need to learn math to be good at development…wait! But some jobs still do!

3. My developer job uses plenty of math!

Of course people still use programming to do math. But programming itself no longer is math.

Even in non-math-oriented languages, there are some applications where math will be useful. And then of course there are whole languages oriented around math, such as Fortran, as I mentioned before, and Haskell, a largely academic language now finding favor among some industry developers.

But these are the exceptions that prove the rule. If a small and shrinking set of programming applications require math, so much so that we cordon you off into your own language to do it, then it’s pretty clear that heavy math is, these days, a minor specialization.

And even if you are writing code to do math-y things, you’re probably not very good at it unless you’re also good at language. The best developers today work on teams, and they do well IFF they know how to communicate – via their code, and directly with other people. As one of my favorite programming books once said, “programs must be written for people to read, and only incidentally for machines to execute.”

The long view

If programming is so similar to language, why haven’t we – developers – already made this mental adjustment? Why does the idea that “if you’re good at math, you’ll be good at programming” persist so strongly?

When programming was just getting started, early in the last century, we used it to solve highly mathematical problems like calculating missile trajectories and decrypting secret messages. At that point, you had to be good at math to even approach programming. Tools, such as programming languages, were designed specifically to solve mathematical problems, because those were the ones we thought it was worth spending money on. Computers were for doing math.

Over time, due to lots of different factors, our societal conception of what computers are for has evolved. When considering this question, these days we think in higher-level concepts such as solving a problem, making some tedious thing more convenient, and/or making money. These higher-level goals sometimes include mathematical subgoals, but also include things like ease of use, connectivity, and interface — problems that can basically be summed up as “messy humans and their relationships to other messy humans.”

So as a result, while programming is still applied to some mathematical problems, in our modern world it is more frequently applied to other, messier types of problems. The shift happened pretty quickly – it started gathering steam in earnest in the 90s. And today – only 20 years later – we find ourselves with math-oriented programming jobs firmly in the minority.

It makes sense that slow-moving academia hasn’t caught up yet. And the programmers who today are the senior developers, the old guard, came of age when this wasn’t yet true. So of course they think the path to success looks like theirs.

Don’t Panic

You can still be successful if you walk the traditional path. If you’re good at math, you’ll probably still be good at programming.

But the rapid evolution of our industry means that math skills are no longer the only indicator of potential developer skill. In fact, they’re probably a weaker indicator than they’ve ever been, given where the industry’s going. So please, guidance counselors: send us the ones who love language. We’ll give them the tools to change the world.

66 comments to Programming Is Not Math

  • I think this is spot on.

    Just like learning a new language, learning to program is as much about the concepts *behind* the words as the words themselves. In French, there’s a word, *chez*, which is a preposition which means “at the home of”. We don’t have a preposition for that in English, so we word things differently. That kind of structural shift in thinking is most of what you’re learning when you learn a new language. The syntax is the easy part.

    But that’s not the same as learning French by learning linguistics. Linguistics can describe French, and even help you understand its features if you’re into it, but it’s not required and it’s not the same thing.

    There’s a meaty region south of syntax and north of mathematics that we don’t have a good name for, and that’s what we learn when we learn to program.

  • If you love an intellectual pursuit, it becomes the lens through which you see everything. I love math and physics, so I model new problems in terms of graph theory, calculus, and statistics. I don’t pull out a pen and paper to _do_ serious calculus every day, because I’m a programmer rather than a mathematician. But these things form my framework for understanding the world.

    Some of the best programmers I’ve ever worked with were philosophy majors and East Asian studies majors and former sociologists. Our field is really becoming a melting pot for worldviews, and diversity is a fantastic creativity multiplier.

    On the other hand, programming is an engineering discipline. You have to know what’s possible to do, and when the project is done you have to know whether you succeeded. You have to measure performance and model the behavior of systems that are too complex for one person to understand. Math — statistics in particular — is very good at these things. I firmly believe that any programmer, no matter their level of experience or their academic background, can benefit enormously from learning some math. As much as I love linguistics as a lens through which to look at the world, I’d send my developers to a couple math classes first.

  • Programming is language *and* maths. Maths skills can really help a lot of developers out, or they make odd, quixotic decisions that lead to cartesian products or exponential performance issues with scale. People not good at maths tend to be prone to those sorts of errors.

    Then again, people who are rubbish at communication often make bad developers (rather than bad programmers) too – so I think you’ve hit on something about the language skills. If you can handle the compartmentalisation of multiple spoken languages you can do it with the switch to a computer language. Software development is about so many things, and is largely about the disambiguation of the words of non-developers in order to create an end result.

  • This is a great write-up, and as a CS education researcher, I agree that the old guard’s beliefs about CS and Math are a huge barrier to getting people to want to try their hand at programming. At my university, you need Calc 1, 2, and 3 to graduate in CS because those are common requirements across the entire college of engineering. Students I’ve met who pick up programming like naturals don’t want to change or double-major because they don’t want Calculus to kill their GPAs. I’ve been working on a project to create a math-free intro to CS course to be taught in high schools, but that won’t do us any good if “Math skills” still act as a gatekeeper.

    On the bright side, the trend seems to be changing. We are seeing this trend called “Computational Thinking” emerge in the academic literature that is getting us to rethink our prerequisite structure. I just read a paper yesterday [1] talking about why computational thinking helps in fields besides computer science, and Seymour Papert has been at this for years. Hopefully these are the kinds of people who start pushing a new agenda for curriculum design in our discipline.

    [1] J. Wing. Computational thinking and thinking about computing. http://rsta.royalsocietypublishing.org/content/366/1881/3717.full

  • Eli

    (guidance counselors, please do not use standardized test scores as a tool to send the ones who love language. the last thing we need is code that reads like Kant. but onto practical matters…)

    Doing a literary-style outline is a great way to find levels of abstraction, especially with a mindset towards DRY-style refactoring. Example:

    I. albums
    A. show
    1. coverpicture
    2. more_pictures link
    3. audio
    B. edit
    1. album_form
    2. pictures_form
    a. image_tag picture as label
    b. radio_button is_cover_picture
    c. manual album_order

    II. events
    A. show
    1. coverpicture
    2. more_pictures link
    3. details
    B. edit
    1. event_form
    2. pictures_form
    a. image_tag picture as label
    b. radio_button is_cover_picture
    c. order of event_pictures?
    i. event_order? (manual)
    ii. sort by picture.timestamps? (automagic)

    Q. create partials at resource#edit_pictures_form? or _pictures_form_fields (a,b,c)?
    A. 1.) Can *_order be renamed uniformly avoiding collisions? 2) Event.picture_order_method property for flexibility?

  • tom hamshere

    Re 2) b, I don’t think computer programming is based on mathematical logic so much as electronic circuit logic. XOR, OR, AND, NOT. This is the primary syntax of most languages. The mathematical syntax – equality, less than, greater than, is used for boring comparisons within the clever logical constructs.

    I completely agree that programming is more about language than maths. One of the clearest indicators of this are the words “programming language” along with “syntax”. However, a really good programmer would then ‘splain to you how all languages are mathematical constructs. One of my courses at Uni (Computer Science with AI) was about the mathematics of language, and how any computer language can be defined with maths. Now, I don’t know that this is how people design languages, or if it is a method they use to define the language after its design, but it does seem to be the case that math is employed at the very top level.

    But that was then. This is now. Languages and frameworks have become increasingly abstract. It’s more important to be able to explain something clearly than it is to explain it mathematically, so it’s more important to understand the language used than it is to understand the mathematics underlying it all. You speak truth.

  • Tasha

    Love this! I’ve been arguing this for a long time, ever since high school where I was taking computer science and French at the same time. The similarities seemed very obvious.

    Programming is communicating with basic logic.

  • Bill logsdon

    You need to get into Data Science. That way you can do math and programming (try Python and R)

  • The last two lines of your article are the most inspiring things I’ve read about programming! Thank you for this!

  • Today my advisor in my workplace talked about relation between math and programming. What a coincidence! He was saying that being good at math (and loving it) is not directly related with being good at programming and vice versa. In academia math and programming are equally important if you want to be a good researcher (in Operations Research and perhaps Applied Math).

    I agree that programming is a language. I noticed that when I’m reading the post. I really enjoy!

    By the way, Japanese ftw!

  • J

    I think this is great. I was always interested in computers as a kid but was awful in math. I really wanted to get into programming when I was in high school and college but all I ever heard was “you need to be good at math to be a good programmer.”

    When I graduated, I decided to teach myself to program and realized I rarely used math. I’m now a software developer and couldn’t be happier.

  • murphy

    An interesting and well worded opinion you have there. You cover many points regarding the relationships between mathematics, computer science and software development. But, there is a significant difference between consumer software development and academic, or industrial, research done in computer science.

    For those who do plan on studying academic computer science, however, an education in higher mathematics remains of the utmost importance.

    I offer my own opinion: The idea that programming is the equivalent of computer science is a common misconception. Programming is merely one of many tools used by computer scientists – and scientists involved in other areas – to solve problems…and I mean real problems; not just how to make money selling apps or designing webpages. Computer science is not simply a topic one studies at university to learn how to make a good program or efficient piece of software. It encompasses many fields such as big data analysis, cryptography, ai etc. These fields not only require sufficient knowledge of “programming”, but also of mathematics, analysis and so on. – Obviously an understanding of the relationship between the language and the system is invaluable to a computer scientist, and I mean no disrespect to those who make apps or websites for a living. You might get a broad sense of computer science by reading the first two paragraphs of Wikipedia’s definition of the field. – http://en.wikipedia.org/wiki/Computer_science. (autowikibot?) – One might argue that the most important aspect of a computer scientist is his or her ability to think – which the process of programming requires little of. Anyway, MIT offers an entire course series – with the course materials freely available online – which delves into the mathematics of computer science. Written by the professor of the aforementioned course is a textbook freely available from the Princeton website entitled: Mathematics and Computer Science (with a mathematically rigorous chapter delving into my own namesake). Basically, while mathematics might not be as necessary to ones success in the software development field, I feel pretty strongly that one cannot be called a serious computer scientist without a thorough background in topics of mathematics – especially

  • nick

    Maybe it’s because in many ways, mathematics, too, is a language – one that describes the universe. As such, perhaps those who are good at math have both a propensity for analytical, critical thinking, as well as for language. Clearly, both are required in programming.

    Just a thought.

  • I’ll play devil’s advocate and argue for learning math. Learning math involves learning the language of math, to be able to manipulate a bunch of foreign symbols to get the results you want. You have to be able to express and handle the problem in a language that’s precise in ways that human language isn’t. And there’s a much higher chance that the reasons to be interested in math translate to an interest in programming. My college emphasized that doing well in just algebra or pre-calculus in high school was a sufficient sign of being ready to do a CS major.

    This post is maybe also a reflection on how weak foreign-language education can be as well. :) My impression was that most students in college take a foreign language to fill their requirements and then lose what they learned. I know that I had to relearn how to learn a language when I picked up Japanese again, and even with motivation, there was a lot of memorization and bitter studying to even grasp the basics. If you told me that learning programming would be like learning Japanese, I’d probably not try to start.

  • Anon

    The academic community is well aware that programming is about language. There’s an entire field dedicated to this research, referred to as PL (programming languages). For research regarding the connection between programming, logic, and formal languages, take a look at conference proceedings from POPL or ICFP. However, if you’re trying to suggest that learning a programming language is more similar to learning natural languages like Chinese or German than learning a new mathematical system, I disagree.

    The notion that “if you’re good at math, you’ll be good at programming” isn’t as misguided as you think. The arithmetic you learned in elementary school (value space: integers, operations: +, -, *, /) is a formal language just like any programming language, albeit far simpler and less powerful than most programming languages. The various other maths you learned (algebra, geometry, calculus, prob&stat, etc.) are each formal languages, with different (and intersecting) value spaces and operations. If you’re good at picking up new mathematical systems, you’ll probably be good at picking up new programming languages.

    Math, logic, and formal languages are all maps of the same territory. It’s not necessary to be good at math to program, but if you’re adept at working with one particular formal language (math, by which I assume you mean the math that is taught in the US’s public school system), it’s not a huge stretch to guess that you’ll be adept at learning and working in other formal languages (including programming languages).

  • Great blog, Sarah. You’re spot on that access to programming is no longer predicated on maths ability. Many IT jobs still require a CS degree, though, and many CS degrees still require high maths scores (in Australia at least), so there’s a conundrum that needs to be resolved.

    One thing you’ve said that I’m not sure about is that “math-oriented programming jobs [are] firmly in the minority.” Here in Sydney, a lot of the IT workforce is concentrated in finance, where there’s obviously quite a bit of maths ability required. Any system that charges people for its services will require some maths that’s important to get right, if not a little complex. I think splitting jobs into math-oriented and not-math-oriented is probably too discrete and there is actually a spectrum. I also think the distribution of jobs along this spectrum is different in different locations depending on the concentration of industry. So while there are relatively few people in SF who are using maths a lot, Inwould expect to see a different picture in New York.

    All that being said, I think you’ve correctly identified the trend of increasing numbers of program in jobs that don’t rely heavily on maths, and I think that will continue.

    Thanks again for writing. Great stuff to reflect on as a hiring manager of software engineers.

    Cheers,

    Graham.

  • I think you dismiss the “academic Haskell” a little too readily. From where I sit, I see the pendulum already swinging towards, if not Haskell, then its philosophy of pure functions, immutable state and strong types as a means to developing more reliable and predictable software. The idea that a new language (for example, Go) can receive significant pushback from early adopters for _not being more like Haskell_ was literally unheard of more than five years ago, and now it’s expected. Along with this philosophy comes at least the need to understand the basic mathematics behind it, and with it the sudden realisation (at least for Philosophy-major-me) that so many of the things you’ve been doing wrong for the last decade, you did because you didn’t properly understand the theory behind what you were creating.

    On the other hand, a lot of the “programming is maths” people I know suffer heavily from what I call “Matrix syndrome”, after that scene in The Matrix where Cypher stares at the screen of incomprehensible green garbage and says “I don’t even see the code”. When you stop seeing the code and just see the theory behind it, the fact that theory is represented by a dense pack of lines and squiggles stops mattering. Which is where developers who are strong at writing code that is easy for others to understand and use are absolutely necessary.

    In his last few years at the company, Steve Jobs would often close his presentations with a slide about how the success of Apple lay with it living at the intersection of technology and the liberal arts. I see programming the same way. Mathematics is a tool that teaches us how to write more reliable, efficient and malleable code. The understanding of “messy humans” is a tool that allows us to develop both software that people want to use and APIs that other developers want to use. Everyone will be better at one than the other, that’s natural, but the mathematical programmer who says “I don’t need to improve my understanding of people”, or the people programmer who says “I don’t need to improve my understanding of maths” are both holding back their own development.

  • Here are two references from an academic background that treat programming from a language perspective. Maybe you are interested in them:

    1) Elisa Baniassad, Clayton Myers: “An exploration of program as language”, October 2009, OOPSLA’09
    A nice essay suggestion to consider each program as creating an own language.

    2) Cristina Videira Lopes: Exercises in Programming Style, CRC Press, ’07 2014, http://tagide.com/EPSBook/
    Inspired by a book of the French writer Raymond Queneau, that presented the same story in 99 different styles, Prof. Lopes elaborated the same program (calculating term frequency) in 33 styles. As she consistently uses Python and addresses the same problem again and again, the differences is using the programming language and structuring it become very obvious.

    There should be more, but these two references are the ones I have currently on my mind.

    dsp

  • I’ve been programming for 18 years (the last 12 have even been for money), and the the longer I do it, the more I realize that programming absolutely is math. The problem is that most people who grew up under the US public education system don’t actually know what math is (and I include myself in that). Fully expounding on this will take a whole blog post, to which I’m happy to drop a link here once it’s done, but the parting thought I wanted to leave is that you didn’t take the programming-is-language thing far enough. If you had, you’d have found the unifying abstraction: mathematical notation (which is what, near as I can tell, you call math) is also language.

    Language is a user interface for expressing ideas. Different user interfaces (or, languages) are good at expressing different types of ideas. For example, writing:

    x ^ 2 + 10x = 39

    …in English would require one big-ass paragraph. Clearly, algebraic notation strictly dominates English when it comes to expressing certain things.

    The point is, let’s not be so quick to throw the baby out with the bath water. Let’s also not discount the fact that the state of programming is an absolute, unmitigated disaster. See also: every facepalm-inducing software exploit ever. This is not for no reason. In fact, I can think of several. Lack of rigor is near the top of the list. Maybe a better solution than giving up on math is killing it.

  • LM

    “1B. …because without a mathematical foundation, you’ll have only a surface understanding of programming.”

    Except you then argue about having a degree in the field instead, not whether one has a solid foundation. Isn’t it more likely that those college dropouts that still make it big are the ones smart enough to seek out the knowledge on their own before having it spoon fed to them? Dropping out is not the factor, it’s the part where they already have a job that matters.

    Personally I’m not really interested in the semantic argument. I’ve just observed that as soon as you invoke math, a huge chunk of the programming populace tunes out. Kind of like with functional programming. Both sides are to blame of course: the programmers at large for having convinced themselves they suck at it, and the mathematician types for their confusing centuries old notation and awkward terminology.

    If you want to interface with those messy humans and their messy social protocols though, listening to their speech, looking at their faces, analyzing their writings and interpreting their interaction… good luck doing so without math. Unless you like being stuck on the outside, only gluing together things made by the people who actually know how to do this stuff.

  • Craig Read

    I couldn’t agree more.

    I started learning Ruby on Rails 2 years ago. That journey led me to JavaScript, CoffeeScript, Haml, CSS, Go, Haskell, and (more recently) Swift. Over the same time period I’ve also been learning to speak Mandarin and German. And recently I started re-learning how to play guitar.

    I don’t have a CS education, and I suck at math. I seem to pick up languages and abstract concepts fine though.

  • Want better programmers?

    Remove the calc, linear algebra, discrete and physics requirements and in their place add literary criticism, public speaking and maybe a little technical drawing. Get some people who can quickly process specs and docs and effectively communicate with teams, give exciting presentations and draw convincing databases and queues.

    I have rarely suffered in my career as a direct result of not being mathy. I have indirectly suffered (been snubbed for interviews due to my background). Often I have discovered something powerful in math that I could employ in my career — such as series and sequences — but usually in ways that were very tangential to their instruction. I graph time series all the time and have never once had to prove one was divergent or convergent — I can SEE that, on the graph. What’s useful is understanding that either can be modeled as a function, and that functions can be chained to perform translations on data. What’s less useful is exploring the monad (although this will lead to some awesome Erik Meijer talks).

    Instructing programmers as mathematicians and scientists prepares them poorly for a career that’s mostly creative application of technical skills, peer communication and diagnostics. It is harder for these people to find their place in industry and harder for promising young thinkers without the stamina to abide the math to enter the field.

  • Sarah,

    You make some very good points. Language is indeed extremely important. I would add a wider perspective on language. But I will come back to the main point of your post.

    Many animals communicate, some with sounds. Humans, however, are in a different league. Our facility with language is what allows us to collaborate in *large* groups. In turn, our ability to collaborate is what drives a lot of progress.

    Then we discovered writing. This was a small step in language use, and a big step ahead for humans. With writing, we enchance our brains. It’s like having better memory, better visualisation abilities.

    And then came the next step in language evolution. It’s called *maths*. Really, that’s what maths is. Look at a reasearch paper in branch of math you are unfamiliar with. It will seem written in a different language. That’s because it is. Maths is not *one* language, but a *factory* of languages and notations. Using this factory, we can now pack huge amounts of information in tiny spaces. The main tricks are notations and definitions. (Nate Abele gives a nice example above. It matches how math books evolved over centuries. I hope Nate writes that blog post.)

    Arguing that programming isn’t maths is itself a matter of definitions. In this case, it is a matter of what “maths” means to you. I agree with pretty much all the concrete observations you make. But, it still sounds very weird to say that programming is not maths. Let me make an analogy. Suppose that someone makes an argument that music is not an art. Most pieces of that argument convincigly point to differences between music and painting. It also notes that being good at painting doesn’t seem terribly correlated wih being good at music. And then concludes that music isn’t an art. Well, whether that argument is OK depends entirely on how you define art. Similarly, I find it much more reasonable to *define* math to encompass programming. That doesn’t make programming any different than it is. Just like defining “art” to encompass both painting and music doesn’t change what music is.

    Thanks again for your post.

  • Jeff Rick

    You would enjoy Andrea diSessa’s “Changing Minds” book. In it, he makes the argument that programming is a literacy and applies this to programming for children. While diSessa is an academic, that book is written for a wide audience.

  • as a python engineer who has worked for 5 years, and without cs/math degree, i must say, of cause you dont need good at math to good at programming, but since programming are the way solving problem, many funny and advanced problem needs math/physics knowledges to solve.

    though this, you dont good at math doesnt means you cant good at programming, because the problem is math and the education system, for eg, math has massive different symbols which will be treat as garbage if you read it as programming code.

    also a math degree require you at least archieve average level on every sub-topic of math, if you only good at 3D math, it might not help you got a math degree, but it can help you on game programming

    the math should change, and the education system should change, people should be tagging as precise skills(for eg, `good at number thoery`) not be categoried to split domain

  • Thanks for writing this. That pernicious lie certainly had its effects on my career choices. But after a tour through a 4th foreign language (and 3rd language family)it was blindingly clear to me that code is simply grammatical logic stripped down to its barest essence and animated by a very finite set of vocabulary. Learning a new (natural) language forces also conscious analysis of how different objects are conceptualized and how they relate to one another, which of course is exactly what one does when coding as well.

    But more off-putting, perhaps, for those who like languages is the notion that goes along with “you must be good at math”: that coding is for people who like things to be black and white, with categorically right or wrong answers, when in fact there are many ways of architecting and writing a software solution. More: http://wp.me/p2QhAS-2D

  • Meena

    I’m quite surprised. I would think Chomsky normal form and finite automata would have made this connection between programming and language more obvious. And of course, natural language processing.

    I would say going into graphics, trying to render 3D objects, etc does require a bit of math. But overall for more programming jobs not much is required beyond addition/subtraction. Then again, for most developers only very small portion of the day is spent writing code. The rest in meetings, email, debugging, issue triage, etc.

  • So essentially you are saying that there is a confusion between programming and computer science. Computer science is about finding out what sort of problems are computable, how such computation may be applied to real world issues etc. – generally , how to build a computer. Programming today has reached the point where one learns how to make a pre-built computer do some specific task using languages and libraries. Math is important for computer science, but not for the programming.

    Aviation analogy: To build aircraft, one must study aerodynamics and a lot of physics that requires math (aeronautics engineers = computer scientists). It is not necessary to know very advanced math to learn how to fly an airplane. (pilots = programmers). At it takes no math to pay and utilise the efforts of the aeronautics engineers and pilots to sit in an airplane and use it to accomplish your partical travel itenerary (passengers = users).

  • nil

    Although some valid points are presented, I cannot agree with the overall conclusion.

    Whereas many programmers do not use math directly in their jobs, programming essentially requires a lot of the same skills that will make you proficient at math: abstract thinking, logical reasoning, understanding complex structures, and the ability to combine these. Language skills skills (and studies) DO teach you these things to some extend, but not nearly to the same extend as math does. Learning a programming language is rather easy – using it to build complex structures is much less trivial.

    Still, my point is not necessarily that a math education is required to perform most programming tasks – but rather, that people who tend to find math easy also tend to be good at programming! This does not mean that people who have not been exposed to maths are bad programmers, but in would strongly argue that good programmers without math exposure would still be the ones who could quite easily learn math if they wanted to.

    The cool thing about actually learning math, is that it stimulates an develops the low-level skills that are required to do programming at a complex level – this is something language studies don’t do to nearly the same extend! Still, if you want, you can get many of these skills simply by… programming.

    And even so, you can be a successful developer without being naturally good at math – but in my experience, without this ability, a programmer will not effectively be able to adjust to higher levels of complexity.

    Of course, these are just my observations. But thinking about it, I have seen extremely many examples that confirm the above, and only very few that break these observations. A few examples of these observations:

    In Denmark where I live, we have several different programming educations. The two most common are the traditional computer science university degree and a shorter 3.5 year practically oriented programming degree (without math and extra stuffing; not a masters degree).

    With very few exceptions, of all the people I have worked with, the ones with a CS degree far outshined the ones with the practical degree. Indeed, the CS majors do have “more” studies (5 years), which might give an unfair advantage. Still, this observation is even valid for people who have 20+ years of industry experience (you would have thought that the odds would even by then).

    Fine, this might simply be due to the fact, that smart people tend(!) to go for the masters degree rather than the more easy one. Yet, we have a third kind of programming education in DK, in which people with a different bachelors degree can take a CS major. This education contains people with all sort of minor degrees, including science (physics, maths, chem.), languages and so on.

    Again, this is a bit unfair, as science minors might have some exposure to programming during their studies, whereas this is not the case for the language minors. However, in my observations, even the science majors that did not have any exposure to programming at all, have a far easier time during the studies than the ones coming from a humanities background.

    Of course, there are exceptions to this, but it holds for the far majority of my observations.

    So, I do not agree. Indeed there are programming-related tasks that people with language skills will find a lot easier on average, but actually programming complex systems is not one of them.

  • The disturbing thing here is that programming absolutely is related to math, and is not language in the Chomskian sense. Natural languages, like French, are very different than formal languages, like Ruby, and the difference is that one is math and the other is not. One is a limited set of formal symbols that can be combined to express specific and unambiguous meanings, and the other is much, much broader.

    Automata theory is math, every regular expression is a mathematical expression. It isn’t calculus, but neither is trigonometry. It isn’t set theory, but set operations are a core part of most working languages (difference, exclusion, and so forth). Programmers use and implement those concepts. Recursion is a mathematical idea, programmers use it (sparingly, but there are times when you should). Programming isn’t integration or calculus, but it IS math.

  • Akien MacIain

    I was delighted to skim this. I have to admit to a lack of bandwidth to really read it, as engineering manager for our startup, I just don’t have a lot of time. But that’s engineering manager to a company building a 3D Scanner I developed (hardware and software – software with the help of a team), on top of a 20 year career as a Software Test Automation Architect. I’ve worked for Symantec, Broadcom, and a host of others. But I got an early start. I didn’t drop out of collage to go into computers, I dropped out of high school. My team includes somebody who’s done video game graphics programming. He’s my “physics of light expressed in math” expert. As a software architect, abstractions are really important to me. It’s one of the things I learned early on in my career, out of laziness. It enabled me to build code that was much easier to maintain. I didn’t even learn the term abstraction (as relates to this work) until may years later. Myself I have developed an intuitive understanding of the relational concepts math describes, that’s what enabled me to build the scanner without even ever completing algebra. But in communicating that to math experts, I have to rely on my own math expert. It’s led me to think of *math* as a language. Programming is not a language, it’s just the way I think. *grin*.

  • bob

    wow. as i read your first paragraphs i thought “just like me!” (except, unlike you, i wasn’t much good at math). i took a random CS course in college. it turned out to be fortran. i loved it! the only difference was that this was 1975. long story short i had a wonderful 35 year programming career. mostly business programming so very little math needed.

    i know that there are areas where math is necessary, but i wish more kids would get the message that you don’t need to be a math genius (or any kind of genius) to program. just logical thinking, and the ability to enjoy spending copious amounts of time on the rather tedious task of writing lines of code.

  • Jacob Turner

    There is one thing you may be missing only due to not pursuing Math further than you did.

    Programming does not require you to be good at Math, not strictly. Sure, it can help, but being good at Math helps with LOTS of things.

    There is a link between the two though. If you are good at Math, you will likely be good at programming. If you are good at programming, you will likely be good at Math.

    Simple reason: In both cases, you are learning another language. Simple as that. Consequently, if you are good at learning any new language, you are likely good at Math, and Programming, and learning any OTHER new language.

  • Radek

    Just as it’s a common misconception that CS = programming, it’s also a common misconception that math is just integrals, derivations, flops etc. There’s a whole bunch of other disciplines in that scary radioactive bin labeled ‘MATH’, and a lot of people in software engineering say that it’s not needed just because they never felt like learning it.

    There are many disciplines, such as graph theory, set theory, predicate logic, complexity, statistics etc., that have helped me do my job. I am grateful for having studied them. I am grateful that I can say with a certitude what the implications are if I use this container type or that one. I am grateful that I know the proper negation to a logical clause (which many self-learned programmers don’t). I am grateful that I don’t blindly make an average of 100 numbers and call that a representative sample. I am grateful to my math.

    Sure, you usually don’t need math to make websites. Just one more common misconception to add in the bucket: programming = building websites.

  • But math is also about language. If you’re good at languages, you should study math!

  • Jeff

    Hmm. Programming is logic, not language. Both lower math and language are ways of making abstract logic more concrete. Programming is also a way of making abstract logic more concrete.

    So, really we have three things that do something very similar, but different: Language, math, and programming.

    To put it mathematically and programmatically: Language != Math != Programming AND Language ~= Math ~= Programming.

    All three stand side-by-side as methods of communicating an underlying understanding. Programming is just best suited for communicating process, math is best for communicating the current state of any system and language is best for, well, general communication.

  • But math is language too, so programming is, indirectly, like math.
    Here’s an interesting article on the grammar of math: http://languagemagazine.com/?page_id=6001

    As for the math-skill-that help with coding, I think the notion of a function (inputs outputs, domain, range) is a very useful building block. Also, as much as I hate the “memorizing procedures” approach to learning math, they’re kind of a good examples for algorithms.

    Overall though, I agree that math is not a hard prerequisite for coding. More like a suggests, in apt-get…

    (speaking of apt-get, I wrote a short textbook on calculus and mechanics including all prerequisites… check it out if you want to learn math)

  • Richard Hein

    Seems to me that the confusion is more about what is mathematics? Certainly, functional programming is mathematics. You can’t guarantee that you can do algebra with programming languages unless they are purely functional, and have referential transparency. So, it’s more like, programming is not algebra (usually). There are many forms of mathematics besides algebra as well. What’s math? A system of symbols and rules for manipulating those symbols that follow from first principles based on socially agreed upon axioms (i.e. like what a straight line in a 2D plane is). Programming languages are too, but sometimes they have non-theorems because they cannot be proven from axioms alone. So the difference is really a matter of formal proof.

  • Hiya Hacker News persons! Welcome. I’d love to have a pleasant conversation with you about the relationship between programming and math. To that end, I have deleted (and will continue to delete) comments that are condescending, aggressive, or insulting. Feel free to still submit them if your ego could use the boost! But know that no one else in the world will ever see them. 😀

  • Richard Hein

    Can you describe any programming language with mathematics? Yes.
    Can you describe mathematics with a programming language? No.

  • 150% agree. Also love your HN welcome. HN is relatively mature; pray you don’t get Slashdotted – you’ll need a shower afterwards.

    I said something similar back then.
    But it’s worse. Math envy has become institutionalized in both academics and practice. Computer Science is funded as if it were a branch of applied mathematics and so is locked into that view. Over at HN the elite hackers get excited about Haskell and functional programming, which are all about making programming more like math (and incidentally showing off how smart you are).

  • Bob LeChef

    Well, of course math is not programming. Math is a science and programming is an art or an engineering field. The aims and methods are quite different and after all, aim and method(s) is what defines a discipline. For the purposes of this post, math is largely concerned with quantity and its method is largely deductive (although truly great mathematicians have made good use of intuition and even before proceeding with any systematizing, not to mention the wide use of heuristics to corroborate hunches). Math is a theoretical field that aims to discover mathematical truths. Programming is about the construction of information processing systems. The final aim isn’t a truth so much as a thing and the methods employed are very often empirical (very rarely do software engineers prove the correctness of their code). In any case, one needn’t go far to see one is different from the other and indeed experience shows that people good at one are not necessarily good at the other.

    I don’t have the time to address all of the concerns in the article or the posts, but there are a great many misconceptions floating around about what logic is or aims at (programming isn’t logic), what math is and what it aims at (programming isn’t math), what language is (what is meant when people say math is a language? they probably don’t have the right idea) or what “abstract thinking” is (an abused term to be sure). Frankly, most people don’t know what they’re talking about.

    • While the aims of a professional mathematician can be different from that of a software programmer, that does not mean that software is not mathematics.

      Those mathematicians who work on Wall Street, for instance, are not so much looking for “mathematical truths” as they are looking to create models for financial instruments. Are they no longer mathemiticans as they wield the power of Ito Calculus? Or someone creating the physics behind games and having to wield the power of matrix and vector math?

      Let us not confuse the goals and motivation with the definition of mathematics. There are significant overlaps in many specific areas.

  • Akien MacIain

    You’re funny. The OP is not the idiot… Most software work is about moving data around. Sometimes it’s about transforming the data following rules. Seldom, in my experience, do those rules actually require math. Lookups don’t take math, string concats don’t take math, conditionals and loops require no math beyond 3rd grade level.

    I also notice dozens of programmers here who’re saying “yeah! that’s my experience too!” and then there’s your lone voice.

  • There are lots of different types of math and programming tends to be more of a (broken) category theory in most cases. This is most apparent in functional languages like Haskell but it extends to even the most OOPL’s if you consider the environment an implicit parameter to each mutatey function call. Math can be just as high level as any programming language (or spoken language) but most people have a familiarity with arithmetic or calculus that causes them to prematurely conclude that ALL math is like that. /rant

    • Indeed that is the case. Most people have no clue what math really is, and consider the crap they were exposed to in high school or undergraduate college is all math is.

      Real math is, in many respects, not all that far removed from software. Both involve symbol manipulation and abstractions, and both usually are doing operations on inputs and producing a result. I don’t see the difference, really.

  • richard hein

    But lookups and concats DO require mathematics, it’s just hidden behind some abstraction, but it is always there.

    • Akien MacIain

      Looking up a string in a table don’t require more than 3rd grade math. You need to know how to add 1 to an iterator.

  • mt

    Just leaving this here, “Propositions as Types” is a great history on the interconnectedness between logic and programming: http://homepages.inf.ed.ac.uk/wadler/papers/propositions-as-types/propositions-as-types.pdf

    You don’t really need much training in anything these days to write a simple web app, but that doesn’t mean going for deeper learning isn’t rewarding. At a certain point you’ll want or need to understand how your systems work, and for that both CS and math (logic, set theory, group theory, etc) are necessary.

  • Mark

    I was disappointed to read this article perpetuate the myth that programming is not maths or that the link is tenuous. All programming is exactly maths via the Howard-Curry isomorphism (as known as the H-C correspondence). Types are propositions and our programs are proof of those propositions. Logic and programming map directly to each other.

    When people talk about refactoring, coupling, modularisation and abstraction they are directly independently moving towards maths and functional programming. All languages are adding elements from type theory and maths independently to various degrees (C#, Java, Ruby, etc.) because they make things simpler, increase productivity and reduce defects and rework. I agree with many others that denial of this link has had a very strong negative affect on the programming industry over many years.

    There are, of course, other elements such as natural language, leadership and collaboration, but I find too much emphasis placed on this.

  • Jeremy

    The notion that Big-O is “meaningless” is misguided at best and flat-out wrong at worst. I’ve personally had a clever linear algorithm be the difference between shippable product and an embedded processor falling flat on its face. And to do any sort of serious scale of nearly anything, understanding Big-O is critically important.

    Is it always important? No. I know plenty of devs who haven’t used it in years because that’s not really something of value to them in their jobs. But for some of us, it’s not just important, but central to being able to address a serious problem in a given piece of code.

  • I like what you say about O-Notation being about “your data.”

    However, the Churchill-Turing thesis puts beyond *all* doubt that programming is math and math is programming. Going over this thesis is pretty much a 3rd year college course, but it states, “Every effectively calculable function is a computable function.” http://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis This means that whatever is expressed in math can be programmed and whatever is expressed programmatically can be expressed mathematically. In fact, through the building of a language via a compiler it’s possible to do both, and all computer languages have cases where math is code and code is math.

    But to pay the bills is math needed in a tech industry job? I know tons of social media coders (part marketer, part knows enough python) that make way more money than my mathematically over-educated ass does. Maybe a better article would be “Social Media Coders” make more money than people with CS degrees.

  • Programming requires logic skills and analytical skills – both of which you can get from math, but not always. Boolean logic is more important to programming than math in general. Can you problem solve? Are you an efficient thinker? You too can be a programmer.