8 ms·
Coding Horror: Should Competent Programmers be "Mathematically Inclined"?
- dinkumthinkum 18y agoJeff Atwood posts more anti-intellectual drivel. News at 11.
- ojbyrne 18y agoI've had a personal experience with people (not developers) who couldn't understand the concept of simplifying equations. So it was "add 20%, +8, x 2," or something to that effect. I said "you mean x 2.4 + 16". Their response was "just do what we said." So I think a minimum level of math is required, just like a minimum level of language skills.
- tokenadult 18y agoWould the code for the simplified equation be commented so that a business type who wondered why it was represented that way would understand what underlying expression went into the code? I heard a scary story from a professor of economics who teaches business students. She said she talked about multiplying some value by 20 percent, and wrote on the blackboard "* .2," and then had students ask her why she wrote ".2" on the board when she had just said "20 percent." It probably avoids business logic mistakes to make the steps VERY explicit, so that the businessperson doesn't try to "correct" some error in the formula.
- plinkplonk 18y ago"Would the code for the simplified equation be commented so that a business type who wondered why it was represented that way would understand what underlying expression went into the code?" Why would a "business type" be looking at raw source code? (unless maybe said code is in COBOL)? I am not being sarcastic, but I've found even good business folks, being lost in (what to my eyes was) very clean code.
- tokenadult 18y agoI was wondering if it might be useful for subsequent programmer to be explain on the spot (as, for example, in an IM conversation--thanks for that follow-up) that the code is indeed doing what is desired by the business logic.
- ojbyrne 18y agoThat was indeed my response. But it lessened my respect for the people in question.
- jimbokun 18y agoI remember working in a bank and a colleague having to explain operator precedence (multiplication over addition) to a "programmer" who did not understand why his program did not work. Scary to think about people like that writing software to handle people's money.
- ojbyrne 18y agoThis was an IM conversation.
- lbrandy 18y agoFirst, Jeffs view of programming is too narrow. Secondly, and more importantly, so is his view of math. Being "mathematically inclined" does not mean being well educated in mathematics. You don't need to be able to rigorously prove the fundamental theory of calculus to be a good programmer. Most of mathematics does not directly apply to programming but the thought processes are extremely similar. If you see someone sorting papers and try to figure out why they are doing it inefficiently, that is mathematical inclination. Its about thinking in algorithms, not mastering differential equations. He's created the strawman that a strong mastery of mathematics is required for competent programming. That is not whats been said. A strong mathematical inclination is a way of looking at problems that programmers and mathematicians share. Its about seeing "through" problems and finding solutions. Its about reducing problems to previously solved problems (or simpler versions of themselves), etc. I can list a dozen ways in which programmers and mathematicians do similar things. But, playing along with the strawman, real math becomes necessary in normal programming fairly often. Not 3d, Jeff, even 2d. What's the distance between a point and a line segment?
- stonemetal 18y ago>> If you see someone sorting papers and try to figure out why they are doing it inefficiently, that is mathematical inclination. Not really, I would say it was a logical inclination not necessarily a mathematical one. And therein is the rub I see programming as logic and problem solving with little to no inherent math unless I am dealing with a mathematical problem. Kind of like the way writing books is not an inherently mathematical in nature even if quite a bit of math is involved in writing a mathematics text book.
- lbrandy 18y agoThis is bordering on semantics. What's the difference between mathematical inclination and logical inclination? The field of computer programming has made a separation in alot of people's mind that simply didn't exist before. People, especially programmers, view mathematics far too narrowly because they lack historical context. George Boole was a mathematician. The logic textbooks are full of words that betray their background, e.g. the "lambda calculus". All of these things have their roots in mathematics. And before there was computer science degrees, these things -were- mathematics. I doubt, very seriously, that Djikstra would draw much of a distinction between "logical inclination" and "mathematical inclination". So while you might, the original context of the quote in question needs to be considered.
- gabrielroth 18y agoYes, competent programmers should be 'mathematically inclined' in a general way, not because high-level math is itself necessary for most programming but because 'mathematically inclined' is a decent proxy for the ability to manipulate abstractions, which is necessary for both math and programming.
- grinich 18y agoI think that Mathematics is a much larger field than most people realize. How can programmers not be mathematically inclined? Thinking logically about how to model and solve a system using abstract concepts. Computer science is a subset of applied mathematics.
- mustpax 18y agoExactly. Jeff Atwood doesn't even mention recursion in the article once. Even he can't claim it's a highly specialized technique. I mean, ever try to walk through the DOM in JavaScript without recursion? Recursion is very closely related to induction, which in turn is a fundamental tenet of discrete mathematics. I really should stop clicking on Coding Horror links on HN. Jeff is a very different style programmer than I am (and possibly a much better one). But his lack of understanding of the "other programming" is completely infuriating.
- carbon8 18y agoThinking logically about how to model and solve a system using abstract concepts. Which is often just as much or more in line with philosophical applications of logic than purely mathematical. As I noted in other comment, you could then argue that all philosophy and reasoning is basically conceptual mathematics, but people don't generally view philosophy this way despite the concept dating back 2500 years.
- dkarl 18y agoPeople don't view philosophy that way because philosophy never gets far from words. Philosophy and math started to fork at the point where people realized that substituting words into logical schema and then using logical transformations to create new sentences doesn't work reliably, and in fact doesn't really aid thought at all except by suggesting possibilities. At that point, logic became a philosophic failure, a dead end. A curiosity at best. There's still kind of a conceptual overlap; a philosopher might find it stimulating to think about the concept of N-value truth systems. However, he wouldn't think that mathematical theorems about such systems have any strict philosophical consequences. They would just be spurs for thought.
- mseebach 18y agoWhen Dijkstra said what he did, programmers made computers process data in an environment with a very high data/cycles ratio, and doing that efficiently has a pretty large intersection with math. Today, there are very few environments that has a higher data/cycles ratio than anyehere in the Apollo program in the '60, and most of the "hard" problems you'll run in to on a day to day basis have been commoditized - you'll be hard pressed to find a programming language where quicksort is even marginally hard to get to. Projects like My/PostgreSQL, Lucene and so on makes fulltext searches over very large corpuses of data crazy simple, even on consumer hardware. When I did a Scientific Computing project in college three years ago, we ran out of data long before our laptop fans came on. Math matters in computer science, but tooling is moving the "competent programmer"-demography farther and farther away from the "computer science"-demography. And that is a good thing, just like the separation of programmer and user which happened in the early 80's (I guess) Final thought: A former boss once told me, regarding education, that he knew plenty of very good, but no really great, programmers that didn't go to college for math and/or comp.sci.
- biohacker42 18y agoI know great coders, who quit their CS college program because they were bored. That doesn't mean they don't know a SHIT TONE of math.
- Tichy 18y agoOne thing that comes to mind is SQL. I've met many programmers who avoid complex SQL queries and use a "select all, then for loop" approach. Creating a complex SQL query is pure logic a ka maths.
- bpyne 18y agoSpecifically it's operations on sets. Trying to manipulate, in your head, many sets of information - with aggregation and outer joins - to yield a solution set is highly mathematical.
- plinkplonk 18y ago"Specifically it's operations on sets" more specifically on relations, though most database schema in the wild are not really relational. I've personally found knowing relational algebra a great help in designing db s, formulating queries and so on.
- carbon8 18y agoLogic is not "a ka maths," it's very much interdisciplinary, and it's the bridge between math, philosophy, computer science and linguistics. That's why even something as simple as an SQL query uses concepts drawn from each of those fields.
- jibiki 18y agoMy knowledge of philosophy has enabled me to write some brilliant SQL queries.
- biohacker42 18y agoI have not found in practice that programmers need to be mathematically inclined to become great software developers. Quite the opposite, in fact. To anyone unsure about the above quote. Jeff is full of shit. Often he dances on the edge of wrong advice, today he has leaped over it. You don't need to be a math whiz, but you damn sure need to be math inclined. At the very least you need logic. Any kind of graphics programming - math. But if like Jeff your career consists of simplistic apps in VB, well then I still wouldn't call you a great software developer without math. Don't aim to be at best average in your career, it makes for a shitty professional life, which is a big chunk of your whole life.
- potatolicious 18y agoGraphics programming is a very small subset of programming in general. You're basically saying "all programmers need math because some programming needs math"... There's plenty of cutting-edge stuff to be done that doesn't require an intimate knowledge of mathematics. I would have to say that being good at arithmetic seems to be pretty important in programming, though.
- biohacker42 18y agoGraphics, physics, all my work in biotech, all my work in video edition, all work I've ever done. Vast sectors of programming are math intensive. There are few which aren't. Also arithmetic and even more so logic pretty much = applied math.
- catz 18y agoOther programming areas that require math: Pattern recognition, control systems, encryption, image and video compression (discrete cosine transforms in JPEG, discrete wavelet transforms in JPEG2000) any type of simulation (e.g. SPICE for electronic component simulation, RF simulation for electromagnetism, finite element models for mechanical systems) ... Any type of planning system requires math (e.g. convex optimisation, network routing, etc...) - these types of things have huge applications in areas such as industrial engineering and network routing. Basically all the interesting parts of programming require math.
- biohacker42 18y agoFrom crazy Jeff's own comments, and his own mouth: > I was writing an Asteroids clone in Flash a few years back, I wrote my own insanely complicated functions for calculating directional velocity instead of using SIN and COS fantastic, LOL! This supports Steve's position -- it illustrates that you'd need enough math background to at least know in what general direction you should be looking. And save yourself some coding time and pain to boot. Jeff Atwood on April 1, 2009 06:17 AM
- SBev 18y agoWhile I agree with Jeff that Calculus isn't always necessary for programming, other areas of math definitely are. Basic algebra, linear algebra, abstract algebra, discrete math... I apply concepts from these areas constantly.
- jimbokun 18y ago"Knowing even a little of the right kinds of math can enable you do write some pretty interesting programs that would otherwise be too hard." (one of the Yegge quotes in the article) I think this nails it. It's a Blub thing. Jeff sees little use for Math because he does not know of any mathematical solutions for the problems he encounters. But...how can he think of a mathematical solution for a problem if he doesn't know very much Math? Google, of course, relentlessly applies Math to everything they possibly can. I think that has worked out rather well for them. The flip side is that they might lose a good designer occasionally with good subjective judgment about hard to quantify things.
- michael_nielsen 18y ago"It's a Blub thing" nails it even better, IMO. PageRank, MapReduce, the Amazon recommendation algorithm, clustering algorithms, .... inventing those required a solid knowledge of and comfort with mathematics. Of course, strictly speaking this doesn't mean that mathematics is necessary to do great work. Other qualities - say a good understanding of community (think Flickr), or psychology (Facebook), or design (37Signals) - can be equally useful. But, yeah, that post has "Blub" written all over it.
- zmimon 18y agoBut doesn't that quote at the same time draw the very distinction between math and programming that Jeff is talking about? "Knowing some math can enable you to write some programs" - two separate activities, one benefiting the other. So, as a thought experiment, a non-mathematically inclined programmer with strong engineering / design aesthetics who implements an algorithm that has been prescribed by a mathematically inclined person may often produce a much better result than the mathematically inclined person would on their own. Programming is related to and benefits from mathematics, but it is not only mathematics. It brings a whole range of skills into play.
- lacker 18y agoA lot of useful programming tools are mathematical. Bloom filters, machine learning, and big-O analysis (especially with amortization) come to mind. A competent programmer should be able to dive into those things if needed. (Needing to study up on Wikipedia first is fine, of course.)
- ananthrk 18y agoFrom PG's article "Ideas for Startups" [http://www.paulgraham.com/ideas.html http://www.paulgraham.com/ideas.html] "...to attack hard problems you need powerful solvents. I find math is a good source of metaphors good enough that it's worth studying just for that..."
- kmavm 18y agoI get the impression that Jeff is a much better blogger than programmer. And he's not my favorite blogger. I say this not just from his self-deprecation, which I've learned not to take at face value. But these weird non-sequitur "questions" he comes up with for article titles suggests he is not at an adult level of proficiency with his craft. Asking whether programmers "should be 'mathematically inclined'" is like asking whether movie directors "should be visually creative." They damned well better be, or go find something to do with their lives that is not a waste of their and their audience's time. When I was, oh, twenty or so, I used to be one of those systems programmers who thought that the fanciest data structure I'd ever need was a hash table. If you write real code, that other human beings use, one of those humans will eventually use it in a way you didn't anticipiate. And in that use, N will suddenly be large! The user will expect your code to work, and with reasonable resource consumption. "Mathematically uninclined" programmers' code will die with large N, and they're not "inclined" to fix it.
- wglb 18y agoEr, if you are going to invoke Dijkstra, then you need to be aware of proving programs correct, and without at least a mathematical inclination, you are lost, no?
- kmavm 18y agoOh, wait a minute. It's April 1st, folks. Even Jeff Attwood might not be this bad a programmer.
- simplegeek 18y agoAh, but is it really a joke? I'm not too sure.
- dinkumthinkum 18y agoNo, this isn't a joke. This is straight party line Jeff Atwood. Atwood babbles about his pseudo "intellectual curiousity" all the time. Jeff posts a lot of strange stuff. I think Jeff doesn't know C nor any other non-VB, non-.NET language and doesn't really know how computers work and does not math and tries to justify this lack of knowledge on his blog. It's one thing not to know something. It's quite another to pat yourself on the back for not knowing it. But he does this with quite a lot of words, usually not his own. He does this with many other things too; for instance, he essentially applauded himself for not knowing or having any idea once explained what the phrase "begging the question" meant. Yet, somehow he is making a living off barely visible ads and no real job that he discusses; surely Stackoverflow is not making that much money.
- screwperman 18y agoI think Jeff doesn't know C Here: http://www.codinghorror.com/blog/archives/001216.html http://www.codinghorror.com/blog/archives/001216.html surely Stackoverflow is not making that much money. But StackOverflow delivers, more so than most YC startups.
- dinkumthinkum 18y agoYeah, I knew he didn't know C. I agree about SO being more popular or whatever than many YC startups. However, my point was just kind of to be surprised that he is making enough money as a full time blogger posting such nonsense. :)
- nihilocrat 18y agoIf you hate math, and need a means to learn it forcibly, code video games, particularly 3D ones. The experience will probably break a few bones, but you'll come out learning more than you ever would have if you just kept writing webapps all day.
- geebee 18y agoWhile I agree that programming and math are different fields, I have trouble believing that a great programmer would be unable to get through calculus (and vice-versa). Another reason for the association of programming with math is that the two fields have an incredible intersection. As a math major, I took a lot of math courses that cross-listed with computer science or had a heavily computational component. Anyone who has taken numerical analysis or worked through the last third of the advanced algorithms book has seen the extent of this relationship. There are huge classes of differential equations that can't be solved without programming. Same for optimization problems (the simplex method has to be one of the greatest intersections of math and programming in history). Simulation (and not just brain-dead random number slamming) has made it possible to solve probability problems that were unsolvable a couple of decades ago. So while I tend to view math as domain knowledge for a programmer - ie., an area where you apply programming (like chemistry, real estate, acounting...), the relationship seems deeper and more natural.
- simplegeek 18y agoI'm not qualified enough to comment on it. But I personally think Jeff is completely wrong. I'm a SDET (Test engineer) and am a history major. Couple of months back I asked people for math books related to computer science. I got some good feedback. I bought two books a)- What's mathematics b)- Discrete Maths by Susana App. I'm nowhere near a hardcore computer science student as I'm studying on my own. However, I've been able to solve recurrences, inductions and basic mathemtical proofs. I came across this beautiful function named "Ackerman function" and reading it was a pleasure. I don't take care of plants in my garden because it's necessary. I just do it for pleasure, literally. Same goes for maths though I'm pretty damm sure I will never able to do maths as good as Knuth but still. I've a long way to go. But I've ordered some books on proving theorems. I don't intend to become a hardcore mathematician but I would just like to get through this once (just for the sake of pleasure). Here is a personal story a)Once I finished basic Discrete Maths I was writing a command-line based twitter client for personal use and using their API recursion just came as a natural choice (it was so natural that I had to think of how I did it after seeing my code running--believe it or not) b)- I'm fairly confident (and cautious) when I write recursive code now. I'm , by all means, a very average programmer but I would like to think that I've improved a bit. I agree with Djikstra that learning your own language in depth is important for non-native speakers. Learning your language in depth widens your horizon and it creates clarity of thought. At least, I think it's important though I'm still a mediocre English speaker (yet).
- deleted 18y ago[deleted]
- tvon 18y agoI don't think you need to be mathematically inclined, but if you aren't then you probably won't enjoy programming very much (though you can certainly be competent at something without enjoying it). Not that daily programming involves a lot of non-trivial math, but for me programming is essentially a collection of little problems to solve, which I enjoy. Math, at least the parts of it I enjoy, is the same thing, a collection of little problems to solve. Granted, this is coming from someone who enjoys math (the parts I understand anyway) and programming. I'd be curious to hear from someone who enjoys programming.
- d0mine 18y ago"A Mathematician's Lament: How School Cheats Us Out of Our Most Fascinating and Imaginative Art Form" explains why there is a common misconception on what the mathematics is. A complete prescription for permanently disabling young minds — a proven cure for curiosity. What have they done to mathematics! There is such breathtaking depth and heartbreaking beauty in this ancient art form. How ironic that people dismiss mathematics as the antithesis of creativity. They are missing out on an art form older than any book, more profound than any poem, and more abstract than any abstract. And it is school that has done this! What a sad endless cycle of innocent teachers inflicting damage upon innocent students. We could all be having so much more fun. </quote> ([pdf] (25 pages) http://www.maa.org/devlin/LockhartsLament.pdf http://www.maa.org/devlin/LockhartsLament.pdf ) Here's the corresponing discussion on HN http://news.ycombinator.com/item?id=130499 http://news.ycombinator.com/item?id=130499
- Hexstream 18y agoProgramming doesn't require much math per se, but almost all domains in which a computer can help do require math. If you don't know any math you could waste your time rederiving concepts from first principles when you could just have learned the established theory.
- verdant 18y agoIt totally depends on the type of programming. A lot of programming these days deals with business systems (after all, business tends to generate money. At least, I think that's the point). You may not need any kind of complex math to present interesting web applications or generate reports, or process credit cards. However, if you're in the business of developing applications to sell, or figuring the shortest path to send parts down a conveyor, or writing a compiler, you can see how you might need differing levels of complex mathematics. It all depends on your situation. I do, however, agree with the point that in the general case, programmers tend to be able to learn quickly, and learn the types of things to help them with their current problem. But if you don't have a grounding to even know where to begin looking for answers, you have a bigger problem. Certainly all programmers do not need heavy math skills. But it certainly never hurts. All things being equal, I know which one I would rather go with.
- mroman 18y agoI think lumping all of Mathematics together in this context is mistaken. It amounts to arguing that arithmetic is as relevant to programming as discrete mathematics are.
- ramchip 18y agoAs one of my math teachers said once, mathematics' greatest advantage to programmers, or people in general, is to train the mind at thinking analytically. Most people who have a good background in maths won't necessarily use it everyday, but the process of learning and using it itself makes you think more rationally, and gets you used to solving difficult problems with whatever tools are available. It's boot camp for the brain.
- tydok 18y agoIts very common for people that do not grok maths to confuse it with calculations.
- inimino 18y agoJeff needs to define his terms. The problem is that what Dijkstra means by "competent programmer" is not what Jeff means. It's not just that they are talking about different levels of competence – they aren't even talking about the same discipline. Dijkstra may have meant something like "doing meaningful work in computer science" or "solving algorithmic challenges". Jeff Atwood seems to mean something like "gluing libraries together to accomplish a business objective". At the beginning of Jeff's post, it almost sounds like he has something interesting to say about the Dijkstra quote, but that's just because he confusingly uses the same word to mean something almost completely unrelated. As he says "the vast bulk of code that I've seen consists mostly of the 'balancing your checkbook' sort of math." I don't think that's quite what Dijkstra had in mind. Likewise, I suspect finding new algorithmic approaches to tough computational problems is not high among Atwood's interests.
- billswift 18y agoI think that the "right-brained" software engineers and programmers defended, especially in the comments, are probably why so much software sucks so bad. I think Dijsktra overstates the importance of "proving" in programming, but the necessity of mathematical type thinking for a clean design and a clean program is fairly clear.
- Darmani 18y agoThree of the four members of the US's team to the International Olympiad in Informatics (IOI) last year also attended Canada/USA Mathcamp. Take from that what you will.
- trominos 18y agoTo be fair, the ability to solve very difficult algorithmic problems is not particularly related to the ability to do many, many different kinds of programming.
- trominos 18y ago"Math" is just reasoning about any formally defined system. Programming is a fucking subset of math. So any competent programmer necessarily has some kind of mathematical inclination.