views:

467

answers:

7

Much of the material taught these days under the guise of computer science could be more accurately called software engineering, and a great deal of programming is more about gluing together widgets rather than coming up with brand new widgets that work better or do something weird and new. However, there are some clever people who have incorporate ideas from math and/or science in order to make very interesting software programs that can dominate their field. A good example of this is the Monte Carlo simulation for Evidence Based Scheduling in FogBugz that Joel Spolsky writes about here:

Another example of scientific influence on software is the PageRank search engine algorithm from Google that is based on authoritative sources, which is an idea that's existed in academia for a while. Searching a database for things that are similar to a query is a Big Problem that has general applicability in lots of scientific fields, and I think that the academic research done by Brin and Page at Stanford from which Google ultimately arose owes a great debt to the scientific research on the topic of Database Search. Put in business terms, I think that one reason that Google has been so successful is that they leveraged the transfer of technology from academia into industry better than anyone else has done in their field. They did the same thing with MapReduce.

Perhaps the most obvious example of scientific thought is understanding algorithms and data structures and when/where they are appropriate. Anecdotally programmers who have a good math, algorithm and science background tend to be good programmers and to use good data algorithms, because they can understand the math of why a particular implementation is good or bad.

What do people in general think about the role of scientific reasoning in making awesome software? Are these science-based features simply features from a specific demographic, or are they somehow special? Is science a tool for telling you about how algorithms and data structures that you use can be situationally stupid (or brilliant)? More specifically, is it an advantage for programmers understand science and scientific thinking, and will having a scientific/mathematical knowledge lead to better programs?

This is a topic that I think about. I'm a graduate student working on a PhD, and the inverse question about how better software engineering helps scientific discovery was brought up. In the interests of full disclosure, I'm a scientist who loves programming to solve problems, and my answer to my own question is that scientific thought is tremendously useful in how I program.

+8  A: 

I will speak from practical point of view.

If you don't need to solve some hard algorithmic problems or invent something new you can live happily without learning math and reading scientific books. Most programming jobs you can find won't require you to know Fourier transform.

I'm MS in applied math and computer science. For the last few years I can't remember a case when I used some scientific knowledge in my day job.

In fact many people can't explain set theory but use SQL without a problem :)

So if you plan to work in some innovation-friendly company, learning math and scientific aspect of programming would be a good idea. Otherwise it is better to concentrate on learning software design/patterns/common algorithms/etc.

aku
I think the question was about scientific thinking, not scientific knowledge.
mattiast
@mattiast can you develop scientific thinking without learning scientific knowledge and vice versa?
aku
@aku Possibly not, but you can certainly use one while not using (or needing) the other. So it might be useful to learn science even when you won't ever use it, just to develop your thinking. (I know this is a cliché, but it has some truth in it)
mattiast
@mattiast, I agree on general idea, however on practice you need to learn too much to be proficient in some subject. You should measure whether it worth your time or not.
aku
@aku: Oh yes, I didn't think the economic/time consuming aspect at all. But if you happen to have a certain passion and interest in learning science, you should not feel any guilt doing so, even if you are primarily a programmer.
mattiast
+1  A: 

The thing is, it depends. You can know math but be a bad programmer and vice versa. I personally think you should know some math in order to be good but also you should be fast, you should understand what other people wrote and why they did it this way, you should know many languages and you should do some projects on the side to get experience with new technologies. None of those by itself won't make you good but all of those most probably will.

vava
+4  A: 

In most programming jobs, you'll need actual mathematic knowledge and methods beyond basic arithmetic very, very rarely.

But you will need rigorous formal thinking all the time. I believe that it's lack of training in that kind of thinking that leads to symptoms such as cargo cult programming and a lack of motivation to keep your programs well-structured.

Michael Borgwardt
+4  A: 

I used to agree with the posters here who say that maths is very rarely required in general programming. Then I learned Haskell, and discovered an entire zoo of mathematical concepts including monads, monoids, folds, functors, fixpoints, arrows and of course the Typed Lambda Calculus that underpins the whole thing.

One of the most noticeable thing about writing in Haskell is the extent to which these concepts can be translated directly into code. Of course you can still write Haskell without understanding them, but its noticeable how much an understanding of the underlying maths can make hard problems suddenly easier.

Paul.

Paul Johnson
+1  A: 

It kind of depends on what programming you are doing. Gluing widgets together to make a web front end for some business logic you've been handed doesn't take much in the way of math. R&D lives and dies by it.

For what it's worth, my job basically consists of linear algebra and computational geometry (plus the necessary plumbing around it) and our competitive edge relies on how well we scour the ACM proceedings and other research for new stuff to put in the product.

Crashworks
+2  A: 

When I was a student, a special issue in Communications of the ACM (September 2003, Volume 46, Issue 9) helped me answer the question for myself. It included a few articles:

At the time I read these, I was convinced that studying mathematics was important to improve my analysis and algorithmic thinking skills.

Hosam Aly
+1  A: 

I think there are two areas from math or CS theory where a good understanding is really helpful for day-to-day programming: logic and complexity.

Logic -- at least the very basic kind -- appears in almost all programs you write. And once the conditions you need to handle get a more complex than a single if/else, understanding how the conditions relate to one another is really important to make sure your code does the right thing, or at least find bugs later.

A basic understanding of complexity is necessary for all things that deal with significant amounts of data (excuse me for being unscientifically vague about what "significant" is ;-)). When you try to optimize, this knowledge allows you to find operations that have to do with the size of the input (e.g. iterating over a list and for each element, iterate over the list again), thus avoiding to change things at random until it gets faster.

I'm not sure if these things need to be taught in a formal manner as they typically are, with proofs and notations that are alien to most programmers. I think explaining logic and complexity with pseudo-code (or even actual code) would go a long way to introduce these concepts to those students who shut down their brains at the sight of something like "O(log n)", because they "don't understand math".

jgre