Live data from Hacker News

Ask HN: Did studying proof based math topics make you a better programmer?

news.ycombinator.com

21–30 of 54 posts

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#21
I received a Ph.D. in pure math (number theory) from Berkeley, and then worked as an academic mathematician for 20 years, so wrote a few dozen research papers and some books. My ability to write software for doing mathematics was obviously better as a result of studying mathematics, e.g., I started SageMath (https://sagemath.org) and wrote a big chunk of it.

Now I mostly do full stack web development (I have goals that require doing it), and I do often think about my programming informed by intuitions from topology and algebraic geometry (e.g., scopes in programming are like neighborhoods in topology). Having experience with formal logic and proofs also helps in reasoning about what code I'm looking at will do. Experience with rigorous mathematics also makes me more humble about just how difficult it is for anybody to ever reason correctly about anything.

I taught mathematics to many undergrads over the years, and I would recommend anybody interesting in a career in programming also learn at least the basics of group theory and abstract algebra. It's extremely beautiful, and probably different than the other mathematics you encountered, e.g., in high school or engineering courses. There's just so many beautiful and deep ideas in an intro abstract algebra course that aren't very difficult to learn. I initially got into mathematics when I was an undergrad browsing the programming section of a used bookstore, and found an abstract algebra book that was misfiled in the programming section.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#22

I lie to people about programming all the time. I tell them it's not about math, you just have to think logically through every step. With more steps comes more scrutiny, so you study how to optimize. You will read papers about optimization to reduce the number of steps. Those papers have a suspicious amount of math. By the time you discover, "...wait, its all math?" "Always has been." What I personally found helpful…

There’s a lot more to programming than algorithms; so much so, in fact, that I’d say that the sort of algorithm optimization you’re talking about is one of the least important skills to study.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#23
The problem is the premise of the question.

Is “better programmer” a useful metric to problem solving? For a class of problems, probably.

Math and other hard sciences will probably give you a different perspective than a traditional CS education which may help with solving certain types of problems. Those may be programming related, or may be something else. Of course it may depend on the kind of person you are too.

In my opinion it’s worth pursuing whatever feels hard in terms of education, even if there’s not a rigorous CS education. You can always go into CS later.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#24
post #20

If your goal is become a better programmer, your time is better spent working on challenging programming problems. If you enjoy math, go do some math. It might help you see problems differently. If you don't enjoy math, don't grind through it. In general, the best advice for the question "I want to get better at $skill, should I study $subject?" is "just do $skill"

>If your goal is become a better programmer, your time is better spent working on challenging programming problems.

I disagree. If the you'd answered an aspiring engineer with "your time is better spent on challenging engineering problems" then, at the level the asker of this questions seems to be at, that would not be the best advice. A person could bootstrap their ability much faster by studying first (or concurrently) other subjects as well.

I think the same applies to programming. I don't have a strong opinion on proof-based math in particular but "just do $skill" is a large oversimplification glossing over the fact that most skills require at least some subject matter knowledge that is a precursor to performing the skill, either because it's necessary in itself or because studying the subject instills some transferable skills as well.

In the case of proof based math, one skill you learn is how to begin things, or break them down, to first principles and build up from there. That's extremely useful for programming, or problem solving in general. You can learn it in different ways, not just from math, but learning it through math or some other subjects are much more direct paths to obtaining that skill, if you don't already have it, than jumping only into programming.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#25
Learning math helps develop your ability to hold large, complicated logical edifices in your head and to analyze them. There are different ways to develop this skill, doing math is one way to go about it. Programming is fundamentally about reasoning about large logical structures, so the skills carry over. The specific topics may not help, but then again, they might. Learning multivariable calculus and linear algebra will help you if you work in graphics, machine learning, etc. Note that these are huge subjects, and there’s always more to learn—much more than you can pick up in a semester or two at college.

How crucial it is for you to be able to accurately analyze large logical systems depends on the kind of programming you do. In many cases, it isn’t that important. I think I being comfortable with ambiguity, understanding how to satisfy multiple conflicting constraints, how to be political, etc. are probably much more valuable skills. Many programming jobs simply do not require you to be that technical to get your tasks done.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#27
If you want to get good at something, you will get far more return on your time and effort investment if you just practice that thing rather than something tangentially related to it. If you want to get good at programming, practice programming not math. Math may help you but it won't help as much as practicing programming.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#28
Thinking about your code is constructing an informal proof in your mind. Making this more rigorous and thus more formal involves the same trade off of accuracy/ease/speed versus correctness/tedium/slowness that any other formalism entials.

I'd say studying mathematical proof is helpful for developing your proof making skills, but then it is best largely forgotten after you've internalised those skills.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#29
I think "learn B because it will help you do A better" type of advice often doesn't work. But "learn adjacent fields if they are interesting to you, time and energy permitting" may work, as they sometimes do yield unexpected benefits.

I am doing the opposite of what you are asking, as my day job is a mathematician, and I found my hobby of programming sometimes helpful.

Re: Ask HN: Did studying proof based math topics make you a better programmer?

#30
In my case it would be hard to separate cause and effect because math and proofs came before programming. "Back in my day," the public school that I attended had a K-12 math curriculum that included sets, proofs, and problems that had no answer. (You were supposed to write down "no answer"). I was kinda slow at memorizing my arithmetic, but proofs and weird stuff made math come alive for me.

Then my first programming class, in BASIC (in 1981), was taught by my high school math teacher, so there was a math perspective, plus my love of math probably biased my interests in programming. Today, I'm not employed as a programmer per se, but use programming and math as problem solving tools as a physicist.

I know programmers who are great at math, but most are not, and the ones who are take care of the math stuff in a team. Likewise with most engineers. So I'm hesitant to claim that math is a particular boon to learning programming. Rather, it is or it isn't, and that might influence what kind of programming you get into.

Like Joel Spolsky's article about programmers, I think there's a two humped distribution in terms of ability to grasp proof based math. If you discover by accident that you have a facility for it, then you might just try a few more courses because it's a boatload of fun.

https://blog.codinghorror.com/separating-programming-sheep-f...

Post reply on HN