Possible Duplicate:
Is Programming == Math?
Programmers seem to think that their work is quite mathematical.
I understand this when you try to optimize something in performance, find the most efficient alogithm, etc..
But it patently seems false when you look at a billing application for a shop, or a systems software riddled with I/O calls.
So what is it exactly? Is computation and associated programming really mathematical?
Here I have in mind particularly the words of the philosopher Schopenhauer in mind:
That arithmetic is the basest of all mental activities is proved by the fact that it is the only one that can be accomplished by means of a machine. Take, for instance, the reckoning machines that are so commonly used in England at the present time, and solely for the sake of convenience. But all analysis finitorum et infinitorum is fundamentally based on calculation. Therefore we may gauge the “profound sense of the mathematician,” of whom Lichtenberg has made fun, in that he says: “These so-called p开发者_如何学运维rofessors of mathematics have taken advantage of the ingenuousness of other people, have attained the credit of possessing profound sense, which strongly resembles the theologians’ profound sense of their own holiness.”
I lifted the above quote from here. It seems that programmers are doing precisely the sort of mechanized base mental activity the grand old man is contemptuous about.
So what exactly is the deal? Is programming really the "good" kind of mathematics, or just the baser type, or altogether something else just meant for business not to be confused with a pure discipline?
All programming needs logic, some programming needs math.
Math is to deal with small part of the program, logic is to deal all.
This post is similar, but bottomline is yes. Even a billing app or heavy IO are math bound operations. At its fundamental we are talking about mathematical calculations happening for all of those things, but more high level math is governing the choices we make in how all those operations are orchestrated together and managed.
Math, is a lot more than just operations. Its also theory and operation as well.
Mathematics is not only about calculations.
And actually we use mathematics whenever we program since
programming languages use types, but (unfortunately) we treat
them often as raw data containers.
<CoolStuff>
Y combinator
#lang scheme
;(define Y
; (λ(p)
; ( (λ(f)(f f)) (λ(f)(p (λ(x)((f f) x)))) )))
(define Y
(λ(X)
((λ(f)
(X (λ(arg) ((f f) arg))))
(λ(f)
(X (λ(arg) ((f f) arg)))))))
> ((Y (λ (n!)(λ (n) (if (< n 2) 1 (* n (n! (- n 1))))))) 5)
120
>
</CoolStuff>
Programmers seem to think that their work is quite mathematical.
Really? All of them? I've seen lots of programmers hating math and saying they got nothing to do with it.
It seems that programmers are doing precisely the sort of mechanized base mental activity the grand old man is contemptuous about.
It seems like you could have confused programmers and computers. A lot of programming involves higher level math and computers. And the mental process by which you construct the program isn't that simple at all.
IMHO the fact is that math and programming are similar as they both deal with solving problems (well posed ones, generally). Sometimes mathematicians think that their problems are harder (or more pure, or more elegant, or whatever). But when it comes to solutions it turns out that programmers care more about better ones.
Let me show you an example: say your problem is to prove the Fermat's Last Theorem, now say that you are Andrew Wiles and come out with 100+ pages long article on Annals of Mathematics filled with beautiful diagrams, lemmas, theorems and propositions about semistable elliptic curves. Basically material that only a handful o persons can understand and it will take them weeks to do that. Not mentioning that it had taken you 7 years to figure out the solution. So from a programmers point of view your solution is bad as it is difficult to understand, difficult to debug, difficult to maintain and is not scalable. And that is where programming and math are different. So I'd say that programming is about solving the problem and doing it the best way possible.
Now if you are wondering if programming is part of math then I think the answer is yes iff you also consider physics to be part of the math.
精彩评论