Why a mathematician can be an excellent software engineer
poisson.phc.unipi.it
poisson.phc.unipi.it
Imagine you live in a house, and you have Superman-like X-ray vision that makes anything non-metallic invisible to you, and you can't turn it off. In a way, it's awesome. You can see all the wiring and plumbing and instantly diagnose any problems with it, you can see into your household appliances, and you never lose your keys or your cell phone. Many things that are mysterious to other people are immediately apparent to you. On the other hand, you're covered with bruises because you keep walking into doors and walls. You're extremely strong and determined, so when you discover invisible objects in your way, you hit and kick them and continue on your intended path. All your furniture is knocked over and kicked against the wall, and your non-metallic possessions are randomly strewn about on the floor, not that you care, because you only care about things you can see, things made out of metal. Luckily, someone values your superpowers enough to come by every day to feed you, bathe you, place a fresh set of (invisible) clothes in your hands, and cajole you into going through the motions of putting your clothes on, even though you literally don't see the point.
Because you walk into things so much, and just for general maintenance purposes, workmen regularly come by to repair and remodel your house. They yell at you for destroying their work. You get angry at them, because they make a lot of noise, and it takes them forever to get out of your way, and when they're done, everything looks the same way it did before. They say they delivered a new dinette set and replaced a broken window frame, but the wiring and plumbing is all the same, so you accuse them of jerking you around and wasting time. They beg you not to destroy their work this time, which just makes you feel insulted and angry. Sometimes they reroute your wiring and plumbing so they can install a new door and repair a hole you've knocked in the wall. You rip out the wiring and plumbing and put it back where it used to be. They're yelling at you and making fun of you because you've just routing the wiring and plumbing through the middle of the door. You ignore them and commence bashing a new hole in the wall where the old hole used to be. The effort makes you hot and sweaty, so you take your clothes off.
The workmen marvel that you are strong enough to bash a hole in the wall using only your head and your fists, but they constantly grumble that they shouldn't put up with being forced to work with this angry naked superman, no matter how strong you are or how super your X-ray vision is.
That's what it's like when a software organization has a mathematician who can only see mathematics and can't see software :-)
(My degree is in math, but I am not smart enough to get away with X-ray vision, so I have to pay attention to the code I write.)
The X-ray vision guy is blatantly choosing to continue bumping into things where the more efficient solution is to put things in place, leave them there, and remember not to walk into those places. That's the failure to adapt to the environment. A mathematician who made an honest effort to, at the least, not upset the software could do pretty well. Probably.
There's a famous story about von Neumann (don't know if it's true) that he had a hard time finding his house. One day he walks up to a little girl and says, "Excuse me, little girl. Can you tell me where the von Neumann residence is?" And she says, "Yes daddy, it's that one over there."
Intuition (the thing that the article's author bumps his head against without noticing it) is really important in mathematics, even though its importance is usually played down wrt. the importance of handling the technical details (correctness of a proof, keeping mathematical structures in your head). In fact, the same faculty used for the formal work is also used for your mathematical intuitions, but then the intuitions are turned into a proof by checking and re-checking how it all fits together.
Eugenia Cheng (a category theorist) uses the term "morality" for the mathematical equivalent of design patterns: http://cheng.staff.shef.ac.uk/morality/morality.pdf
I've now read the whole thing. It's delightful! Thank you. You should make a separate HN post out of it. It might attract interesting discussion, though that's mostly the luck of the draw.
What she's saying does have parallels in software. Being able to know why something is designed or coded the way it is is critical to good software work. That for me is the connection. I consult this kind of intuition all the time. For example, I had a massive breakthrough yesterday - something I've been banging my head over for months suddenly yielded to a simple solution - but the most compelling thing was that it was a moral solution in Cheng's sense: I can look at it and see not just that it works but why. Finding this solution brought a tremendous feeling of relief. But without the "moral" aspect, I wouldn't have felt nearly as good; I'd have seen the tests passing and things appearing to be correct, but there would have been less relief and more of the uneasy sense that it might fall apart with the next test case.
The material about social proof is reminiscent of De Millo, Lipton, and Perlis on the Limits of Formal Methods, which is also worth reading: http://news.ycombinator.com/item?id=3554556.
Also, one of the most delightful things in the (Cheng) piece is the quote from Hume, showing that as so often, Hume got there before everybody else and said it best.
I still don't think it has the least thing to do with design patterns, though :)
It's easier to teach a mathematician to code than it is to teach a coder some maths.
Anyone who really wants to be a programmer can be a software engineer, because if you are really interested in programming you spend a lot of time programming and that will be enough to get you an engineer role somewhere.
My dad, an MBA, would never admit to it, but I once caught him coding Excel macros. I asked him "Isn't that programming? There's loops, conditions, variables and procedures!" And he goes "I don't program, I automate tasks for moving Excel spreadsheet data into the our data warehouse.".
Moral: Not all programmers can be software engineers, you have to be someone interested in programming.
Also, beware - correlation fallacy. In my experience it doesn't have anything to do with the education itself, I believe you can easily generalize and say the average person taking up mathematics has a better analytical mind than the average CS major who's in it for the hype.
On the other hand, I feel software engineering is a slightly different ball game compared to thinking mathematically. E.g. most applied mathematicians who write scripts try not to go overboard on modularizing the code mainly because it is easier to pattern scan with code that fits into a page (and average mathematical models do). Another useful technique is to use the same variable names that were used while deriving the model in the code. While, I am not necessarily defending the practice, I have from painful experience (writing convex optimization code) found that trying to modularize and introduce "meaningful names" to replace those that you just used while deriving out analytically the model and also making sure that your code doesn't go wonky can definitely be a challenge to get right. So yeah, there might be some retraining needed to do at times, depending on the intransigence of the individual involved this might be impossible or fairly easy.
Concerning the other point, it's also true but it's something else entirely. I never meant a mathematician will outdo someone with software engineering education, obviously he will at least have to read about good software engineering practices. I can also confirm your experience, from firsthand account even, as someone who began coding to do basic applied math. Thinking mathematically generally leads to (at best) efficient but unreadable, one-time-use-only code.
Academically w.r.t maths, mathematicians start where computer scientists end. The biggest bane to graduation of a CompSci student is usually a basic combinatorics class. One guy I knew was given special dispensation to take the class after having exceeded the maximum number of fails allowed for a single class. He was to devote the entire term to just that class. He had finished everything else. Intro Biochem and Discrete Maths I were the two most failed classes.
Then the dark times, the school made Discrete Math I a required class for math majors. The math majors rebelled strongly after more than half of them failed the course for 3 semesters straight. Eventually the school removed the requirement on math majors. It seemed in our situation that Math majors were, as a generalized body where exceptions of course exist, unable to accomplish the logic portions of the course. Most did fine with set theory and combinatorics but completely floundered in the rest of the course.