## How much math you need for programming

December 5, 2014 at 10:47 am | Posted in art, Hacking, Patterns, Programming | Leave a commentTags: esr, evan miller, gnewsense, GNU, Linux, math, paul graham, steve yegge, steven noble, trisquel

Whenever I wanted to learn Algorithms, Mathematics used there somehow seemed to be an obstacle. I admit my Math is not that good but it ain’t that bad either but this “ain’t bad” level of knowledge was not enough to learn Algorithms and the time and space complexities involved and comparisons of sorting and searching techniques which are at the heart of measuring performance of computer programs. I needed to learn all these and in that search I came across several articles written on Mathematics required for programming. I will explain what did I learn from these articles. When it comes to programming, most loudly known math-proponent is Steve Yegge. Here is what I have found on Math required for programming:

- Steve Summit notes on Math (author of brilliantly written C-FAQs)
- Steve Yegge who has written two articles Math Everyday and Math for Programmers
- Eric S. Raymond talks about how much math you need to become a Hacker
- Paul Graham on Math
- Evan Miller’s article as reply to 3 authors above
- Steven Noble wrote an article as reply to Evan Miller’s example of calculating fibonacci numbers

If you do not read all of those above then you will miss the intent of my blog post. As per Steve Summit, Eric Raymond and Paul Graham, you do not need to focus much on Math to become a brilliant programmer, a hacker, the most decorated word for a programmer (I do not mean Crackers who break into computers and steal private data. Read Wikipedia definition and Eric Raymond’s article on definition of a hacker). Steven Noble says you should learn a little bit of Math and Evan Miller somehow seems to agree with all of them but in a bitter way. I myself started programming just for the love of it. Since 2009, professionally, I am progrmming mostly in C, sometimes in C++ and almost always on Linux and sometimes on UNIX. My passion for programming has made me read and write code in many different languages where I had to learn different ways of thinking. Writing code is easy, thinking along the lines of the paradigm on the top of which a particular language was modeled is a tough, daunting and very time consuming task. I have always tried to do my best and got good amount of experience doing that. I think I am qualified enough to write smo comments about those articles mentioned above. So, let me tell you one thing very clearly: **Computer Prgrommaing is not Math**. Let me say it again, computer programming is not Math and will never be. You want to learn computer programming, then learn computer prgramming. Do not flip through Math books, read whatever is written on a particular newsgroup (comp.lang.c, comp.lang.lisp for example), read about all the software that came from GNU and use Linux distro exclusively for everday tasks (I prefer a distro with least amount of binary blob). If you are learning lot of Math because you want to learn computer programming then you are confused and headed in the wrong direction and you will not learn much of programming. Except in the speialized fields like 3D game programming etc., you only need Math as much mentioned by Steve Summit.

As computer programmers, we write programs, but why ? We write programs to solve problems of this world. That is what computer programmers do, they solve problems.

Now what does does a mathematician do ? He tries to understand nature and uses mathematics as a language to do that. Mathematics has helped solved many problems of this world. Look at what Quantum Physics, a branch of physics that has literally changed our millenia old assumptions about atoms, is heavily dependent on Math. Math is everwhere, from chemical industry to societal problems we use Statistics. Take any part of your daily life and you will see how deeply it is influenced my Math. Math has been used as the most prominent vehicle not only to understand nature but also to solve problems of this world. There is a reason for this, all these properties are just inherent in Math. I was not good at Math, so I was trying to solve the problems I was facing everday as a programmer using my intuition, common-sense, flow-charts and more other kinds of diagrams. This went on for few years and I came up with some rules and ideas on which I was building a model to solve problems, the problems that I faced everday as a computer programmer. Building up this model had one aim: to be extremely clear and very brief on what the problem is and same for solution. I was creating a model, to which you will feed a problem as input and it will produce a solution as output using English language, flow charts and lot of other kinds of diagrams I created. This model had certain assumptions, rules and conditions, which again were very clear. Clarity and simplicity were high on agenda. It was a kind of a general, abstract mechanism to be applied to problems to get solutions. Now a few months back, after I read all these Math articles I came across one more article from Evan Miller titled Don’t Kill Math which was actually written in response to Kill Math by Bret Victor.

These two article hit me very hard. First, Bret was trying to do the same thing I was trying from few years, though he was more successful than me in producing something. I could never come up with some solid model which could have been used by everyone and here is Bret who has already done that. Was I happy, yes, because I found what I was looking for and I was ready to follow Bret’s footsteps but I never did. Why ?

There was a reason I could never come up up with a solid model. I always thought it lacked something. No matter what I did and how much I worked on it, I always felt that something very fundamental and basic is lacking. My model lacked a soul, a life can not exist without a soul. Whenver I read Theory of Relativity, whenever I studied Schrodinger equation, Maxwell’s equation, Newton’s laws, Kepler’s laws, The Uncertainty Principle or Shulba-Sutras, I always felt that all those equations are complete, that they have a soul but my model does not. Both of these articles Kill Math and Dont’ Kill Math made me realize what is that soul. It is the properties of Mathematics mentioned in Don’t Kill Math. The questions Evan asked in this article and the way he has explained in very simple and basic details, concluded my search for a model. Math is a terse, short and succinct and the curtest method to solve problems and understand a phenomenon. These brutal characteristics are inherent to Math, just like soul is inherent to every being. With Math you can solve problems in a much shorter and better way than not using it. Try it yourself, read both of Kill Math and Don’t Kill Math and try to solve some problems using both methods.

This brings me to a very basic question: Why did I hate math ? If I truly do not like math then I must not like it now too, but instead it is opposite now, I like math. It was the way math was taught to me in school and college. I was taught rote-math, not real math. Same is true for hundreds of thousands of children who pass out of Indian schools. It is not their fault that they can not comprehend and hence hate Math. It is very common statement from Indian parents that “my kid does not know math, my kid hates math”. It is the fault of school, fault of our education system, not of the student.

Coming back to the primary question of whether we need Math for becoming a great programmer, this is how tho world solved its problems in beginning:

Then came Math and this is what most mathematicians did:

I have worked in software industry for more than 5 years now and this what almost all computer-programmers/software-engineers/developers do:

Evan Miller says you can become first rate hacker without using a lot of Math and I think he is right and that is in agreement with all other authors. The point he stressed was role of Math in solving problems of this world, that Math is brutally efficient in solving real world problems. As programmers, we solve problems, but if we solve problems using Math and then apply programming solutions to the mathematical model of the solution, then we can have some amazing ways of providing better solutions that will make our lives easier as a programmer (kind of side-effect):

I conclude this blogpost with these points:

- You do not need math to become a first-rate programmer because we do not use much of Math directly. If you want to become programmer then learn programming. Computer programming is very different from mathematics, and as a computer programmer you have to focus more on how to write better programs, how to think in a particular paradigm (e.g functional, OO, Generic, Procedural, logical, declarative etc), find better ways to create software, you need to understand design-patterns, not to mention learning and using C for few years will add new dimension to your thinking. All these are not related to math in anyway. These tools we use to solve problems of this world and they are in no way related to Math e.g look at the different paradigms on which different languages are created, you need to learn these first and it will take you few years before you get a grip at them and then you can learn Math if you want. Read Introduction to Progrmming using Emacs Lisp by Roberrt J. Chassell to know how the problem of creating a customizable, self-documenting, ever-extensible real-time display text-editor was solved. Read GNU Make Manual and find out why does it need M4 and Autoconf.
- Math is the most widely used vehicle to understand the nature and solve problems of this world. We can learn more ways of solving problems by learning mathematical methods. I myself have started studying probability because like Steve Yegge said, once you understand Math then you can look at the problem and see whether it a probability problem, calculus problem or statistical problem etc. Math is related to the nature of the problem, not nature of software, software has its own methods and tools of solving problems, keep that in mind.

I want beginning programmers to go on right path. Learning Math when what you actually want to write computer programs is a wrong, wrong path to walk on. Install a Linux distro, I prefer Trisquel for latest softwares and gNewSense if you want a solid and stable distro but with little bit outdated collection of softwares. Install Emacs using package manager on command-line and start reading *Introduction to Programming using Emacs Lisp* and you will get true taste of computer programming. This image shows you the world of computer programming

*Copyright © 2014 Arnuld Uttre, Hyderabad, Telangana – 500017 (INDIA)*

Licensed Under Creative Commons Attribution-NoDerivs 3.0 license (a.k.a. CC BY-ND)

## The Craft of Programming

August 31, 2009 at 11:16 am | Posted in Patterns, Programming | Leave a commentTags: C++, esr, Lisp, Programming, quotes, RMS, software quotes

Here are some quotes I have gathered over the years. They are written by some of the best known Programmers and Hackers with occasionally some very good programmers thrown in, if not great. They inspired me, changed the way I look at programming and especially at some programming languages and methods to solve problems:

*“Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp.” * — Philip Greenspun

“Something we didn’t want was an object-oriented language. OO languages remain a popular fad, but our experience using C++ in the EROS system was that it actively got in the way of understanding what was going on.”

— The Origins of the BitC Programming Language

*
When you want to use a language that gets compiled and runs at high speed, the best language to use is C. Using another language is like using a non-standard feature. * — GNU Coding Standards

*“First off, I’d suggest printing out a copy of the GNU coding standards,
and NOT read it. Burn them, it’s a great symbolic gesture.” * — Linux kernel coding guidelines

*
“C++ will rot your brain” * — someone from #lisp at irc.freenode.net

*“pointer arithmetic and array indexing [that] are equivalent in C, pointers and arrays are different.” * — Wayne Throop

*“An array is not a pointer, nor vice versa” * — Steve Summit in C FAQs

*
“Attitude is no substitute for competence” * — Eric S. Raymond in How to become a Hacker

**Q:** *I’m having problems with my Windows software. Will you help me? *

**A:** *Yes. Go to a DOS prompt and type “format c:”. Any problems you are experiencing will cease within a few minutes. *

— Eric S. Raymond

“This answer cannot be decided by current law—the law should conform to ethics, not the other way around” — Richard M. Stallman

*
“Lisp is a programmable programming language.”* — John Foderaro, CACM, September 1991

** Q: ** *“My company needs a proprietary operating system to get a competitive edge.” *

**A:** *GNU will remove operating system software from the realm of competition. You will not be able to get an edge in this area, but neither will your competitors be able to get an edge over you. You and they will compete in other areas, while benefiting mutually in this one. *

“There is nothing wrong with wanting pay for work, or seeking to maximize one’s income, as long as one does not use means that are destructive. But the means customary in the field of software today are based on destruction.” — Richard M. Stallman

“Haskell saves lives”

“In general, functional languages offer powerful new ways to encapsulate abstractions” — Haskell Wiki

*
“I invented the term ‘Object-Oriented’, and I can tell you I did not have C++ in mind.” * — Alan Kay.

*— Bertrand Meyer*

“C++ is the only current language making COBOL look good”

“C++ is the only current language making COBOL look good”

*
“It’s 5.50 a.m…. Do you know where your stack pointer is ?” * — Anonymous

*
“I understand the philosophy that developer cycles are more important than cpu cycles, but frankly that’s just a bumper-sticker slogan and not fair to the people who are complaining about performance.” * — Joel Spolsky

*
“The standard — either one — is not the End of All C. Writing ‘strictly conforming’ C code, however, has an enormous benefit.”* — Chris Torek

“Wait a minute, I want to modify that statement. I’m not claiming, in this particular article, that there’s anything wrong with Java as an implementation language. There are lots of things wrong with it but those will have to wait for a different article.” — Joel Spolsky

*
“Without understanding functional programming, you can’t invent MapReduce, the algorithm that makes Google so massively scalable” * — Joel Spolsky

*
“It [Java] might be successful – after all, MS DOS was – and it might be a profitable thing for all your readers to learn Java, but it has no intellectual value whatsoever. Look at their implementation of hash tables. Look at the sorting routines that come with their “cool” sorting applet. ” * – Alexander Stepanov

*
“Java isn’t platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. ” * — Bjarne Stroustrup

Copyright © 2006, 2007, 2008 Arnuld Uttre, #331/type-2/sector-1, Naya Nangal, Distt. – Ropar, Punjab (INDIA) – 140126

*Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.
*

Blog at WordPress.com.

Entries and comments feeds.