Dino 'Connect' Bojadjievski's blog on computer programming, computer science and IT in general. Also serves as a random outlet.
Hit counter:
Saturday, October 29, 2011
Algorithm development: Computer programming vs Mathematics
There has been a lot of debate between me and fellow colleagues whether mathematical skill is necessary for computer programming or not. While i used to be a strong advocate of the "logical" programming style, i have recently seen the light, so to speak, regarding the use of mathematics and its application in computer science.
So, what does my oh-so-important opinion state nowadays? Let us look at it from start to finish.
C o m p u t i n g H i s t o r y
Today's computers are used in almost none of the ways they were meant to. Today we send email, open up facebook, listen to music and do all sorts of weird stuff only sleep-deprived maniacs do (e.g. program). But the original computer was meant for calculations of missile trajectories and decryption of enemy messages. Cool and flashy, huh? I bet all of us have written a few dozen uber programs like that. Jokes aside, computers were designed to be the perfect calculator, which they were- and still are. A computer doesn't do anything except shift bit patterns to simulate addition, subtraction, multiplication and division, and it didn't do much less in ages past. In fact, it's about the same. So when asked what is the basic role of a computer, one has to ask himself whether it really is "uhm...stuff", or automated maths.
P r o g r a m m i n g T h e o r y : A l g o r i t h m d e s i g n
I am not really going to cover all I've to say about the intricacies of algorithmic design and research. Needless to say, it is a broad topic best discussed in person, and with a really big chalk board (or in my case, a brown door. And chalk.) But what i always notice when working with, or teaching, novice programmers is that they miss a big part of the software creation process. Namely, they do not design. They start hacking away, writing code and thinking as they go, and always end up wondering why it doesn't work, or doesn't work well. As many times as i have said this, programming does not work that way.
Yet i keep wondering if it is their fault.
Most CS courses and classes start away with programming, and do not focus on algorithms, but that i find wrong. Thing about algorithms is, however, there are exactly two ways to develop one:
-Either logically
-Or mathematically
This does not, however, imply that there are only two algorithms for every problem in existence. No, there are probably many, many more. But these two general mindsets, these two categorizations of algorithms, are all there is. I used to believe that any problem could be solved logically. However, i have recently been proven wrong. Some problems, like file formatting, low-level programming etc., can only be solved mathematically. There is practically no way for one to do low-level programming without Fourier transformations, and third-degree integrals. One cannot write graphics programs without a very, very firm grasp of geometry, trigonometry and calculus. Computer security and networking is all based on numerical methods, and mathematical analysis. And even if there is a logical solution to a problem, rest assured that it is always both slower and less elegant than the mathematical ones.
Now this stems from two, and only two things (which are essentially the same). First of all, computers were never meant as logic machines. In fact, they are far too stupid for that. Instead, they were meant for mathematical problem automation. And the second thing is, while you can simulate logical principles with computers, you can't really do it well. There have been attempts to rectify this, like the programming languages Prolog and Lisp, but we all know how many people use them. And as sooped up as AI seems to be these days, i haven't met a compiler that could outprogram me in assembly, nor an AI program that can beat me in any strategy game, unless it is a ridiculously simple one with solutions hard-coded.
My conclusion and final words are ones of remorse. Kids, learn maths. Perfect algebra. Master trigonometry. Own calculus. I didn't, and now i'm paying for it, even seriously thinking about dropping out of university because of it. Don't do what i did, and be sure that you'll become a far better computer programmer that i ever will.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment