Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work better when I have some firm foundations. This helps me to solve everyday problems better, because I can generalize them. The thing I find in programming is so many things are black boxes. Logic is scientific, but commands are not. A command in a language is just "something that does something". It is very hard to work out what its logic is, without understanding the underlying hardware. I learned brainfuck for a little bit, and enjoyed it very much, but it still has commands. These commands are packages of functionality that cannot really be understood without understanding all the lower levels of logic, unfortunately. What I would like to know is if there are any mathematical or logic principles that help with being able to generalise programming problems?

share|improve this question

closed as not a real question by gnat, Jim G., Walter, Dynamic, Caleb Aug 20 '12 at 16:10

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Can you give an example of a specific programming problem where you need support with mathematical or logical principles? – Doc Brown Aug 20 '12 at 9:24
Are you talking about mathematics or science? Both of these are very important in programming, but the answers are probably going to be very different for each. – Jörg W Mittag Aug 20 '12 at 9:42
I suppose I am talking about either. I think of them the same for the purposes of this question. Science is more of a methodology I guess, and maths is a form of science? I am interested in how either can be applied to higher lever programming, though. – Eric Vi4ing Aug 20 '12 at 10:45
up vote 7 down vote accepted

The thing I find in programming is so many things are black boxes.

Here are some resources that will open those black boxes:

According to an Amazon review:

...The real value of Code is in its explanation of technologies that have been obscured for years behind fancy user interfaces and programming environments, which, in the name of rapid application development, insulate the programmer from the machine...

This Coursera course examines key computational abstraction levels below modern high-level languages. According to the course's description:

...We will develop students’ sense of “what really happens” when software runs — and that this question can be answered at several levels of abstraction, including the hardware architecture level, the assembly level, the C programming level and the Java programming level...

And finally my favorite:

@LieRyan provided an excellent explanation from the atom all the way up to assembly language.


What's the best way to inject science into everyday programming?

There are so many arguments as to whether a Computer Scientist is really a scientist and whether a Software Engineer is really an engineer.

Anyway, the following resources will help you inject science into everyday programming:

Knuth's books are considered to be the bible for algorithms. The study of data structures and algorithms are the closest to the scientific method in the Computer Science field I could think of.

This course covers the essential information that every serious programmer needs to know about algorithms and data structures, with emphasis on applications and scientific performance analysis of Java implementations.

share|improve this answer
Computer science is a cross-disciplinary field which includes some science and some non-science. Simple ;) – Peter Taylor Aug 20 '12 at 15:01
+1 Concise and accurate. – Anthony Aug 20 '12 at 16:04

There is a mathematical foundation to programming. It is called Lambda Calculus and is very interesting. Unfortunatley, except if you are doing some research in CS or designing a new funky language, it won't help you in your every day life.

It will help to learn and really understand languages though. It will also help you to have fun with the haskell people who like to work with things like homeomasofemtomophisms. So I would still recommend some culture in lambda calculus to anyone interested in programming.

If you haven't met them, I would recommend learning about design patterns. I wouldn't call them "science" but it provides a good basis to speak with some precision about some code without redefining everything all the time.

share|improve this answer
+1 for Design Patterns. The GOF book is excellent but the examples were a bit difficult for me, so I found excellent easy to understand examples of all GOF pattern (in PHP) at fluffycat. – Anthony Aug 20 '12 at 11:17
Design patterns are engineering, not science. Engineering is about making things work, science about explaining why it could never work (j/k) – MSalters Aug 20 '12 at 14:29
@MSalters science is also about naming a formal definitions. Design patterns are well defined and documented. Not as precisely as in mathematics, but probably as well as many physics concepts. – Simon Aug 20 '12 at 14:47

I also would check so called Turing machines, see

They are completely formal and stand on their own (meaning no lower level understanding is needed). It is quite complex theory but serves as the most low level base of programming languages and has a mathematical/formal background.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.