How much math you need for programming

December 5, 2014 at 10:47 am | Posted in art, Hacking, Patterns, Programming | Leave a comment
Tags: , , , , , , , , ,

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:

  1. Steve Summit notes on Math (author of brilliantly written C-FAQs)
  2. Steve Yegge who has written two articles Math Everyday and Math for Programmers
  3. Eric S. Raymond talks about how much math you need to become a Hacker
  4. Paul Graham on Math
  5. Evan Miller’s article as reply to 3 authors above
  6. 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:

math-1

Then came Math and this is what most mathematicians did:

math-2

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

math-3

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):

math-4

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

math-5

Copyright © 2014 Arnuld Uttre, Hyderabad, Telangana – 500017 (INDIA)
Licensed Under Creative Commons Attribution-NoDerivs 3.0 license (a.k.a. CC BY-ND)

The Emacs Way of understanding Humans and Computers

November 30, 2014 at 10:28 pm | Posted in Patterns | 1 Comment
Tags: , , , ,

I was using gNewSense frow sometime now and one thing about softwares endorsed or created by FSF is that you get to know some amazing ideas or some incredible ways of solving some problems that you never came across before and you yourself never knew those either. For example, take icecat, it comes default with libreJS add-on installed. Generally we think an OS can control your machine and then you. After using libreJS I see how you can use javascript in a web-browser to control the user, without giving any hint at all. User will use his computer for 10 years and for those 10 years he will not have slightest of the idea that he is being controlled. Then I came across duckduckgo search engine and then ThinkPenguin router  with 100% Freedom and then h-node  and now gNewSense.

When I used Emacs first time, in year 2006, after few weeks of usage I came across The GNU Project (open Emacs and press “Control-h g”), that one keystroke (C-h g) changed my life. I got hooked onto Linux forever (or GNU/Linux as RMS calls it). Since last few years, I have never used/installed any proprietary OS on my machine, my machine runs only on Linux, yes, no other OS, only and only Linux (something that majority of Software Engineering students and prfossionals in INDIA are always scared to do). Just few months back I came across gNewSense and from there I came across one gNewSense BlogPost, an introductory book on programming in Emacs Lisp written by Robert J. Chassell. For those who don’t know, Emacs is one of the most (if not the most) advanced text editors available. I am sure if you make a list of top 20 softwares ever created with best design ideas then Emacs will be one of them (and Apache web server will be there too along with several softwares starting with letter “g” 😉 ). Emacs is written using Emacs Lisp (a dialect of Lisp, an amazing language) while some parts are written in C for portability/efficiency reasons. I am using Emacs all the time for writitg code but I do admit I hardly make effective use of it. I think I use may be 10% of its power. I always wanted to learn more and the book written by Robert seemed like a decent start. I am already writing code from few years now and Robert mentioned that it is “not for experienced programmers” but I am reading it anyway because I always wated to understand Emacs and then this book is so interesing and engaging and I can not seem to put it down. It is as much interesting as The Man Who Sold The Moon . Whenever I will come across some idea that I will like then I will post about it here. So, here is the first design idea I really loved (I assume you are familiar with some dialect of Lisp. If not, then just read 17 pages of first chapter of Robert’s book. That will be more than enough. Do not worry, it will not take much time to read those)

  • You want to evaluate something written in Emacs Lisp ? Just open emacs, put cursor at the end of the variable or function name or the closing parenthesis or whatever you want to evaluate and press “C-x C-e” and you got the answer. That’s it, that is how simple it is in Emacs.
  • File and Buffer are two different entities. File is what permamently stored on your computer’s hard disk whereas a buffer is inside emacs which will go away as soon as you exit emacs. A buffer visits the file or is a pointer to the file, not the actual file. You want to save changes into the file then just save the buffer and changes will be written to the file.
  • This one is most interesting. switch-to-buffer is an Emacs Lisp function that helps you in switching to another buffer. Generally when you look at any editor (Notepad, Notepad++ or gedit etc. for example) , you usually look at the file you are editing. If you switch to another file then you will see only and only this another file and previous file will not be visible. Previous file is open but it is not visible and hidden in the editor). What I mean is you can see only one file in front of you, not two (I am not talking about splitting-frames). Within Emacs code, switch-to-buffer is less used than set-buffer. Why ? … Because computer does not need eyes to see while humans do. When a a computer program needs to work on a buffer/file, it does not need to see it, visibility is not needed. switch-to-buffer was designed for humans and it does two things:
    • It switches to the new buffer .
    • It switches the buffer “displayed” in the window with new one.

You can easily guess now that set-buffer only walks the first step, it switches the program to other buffer while buffer on the screen remains unchanged.  Doesn’t this concept feel like one of the rules of the creation of this Universe while still being so simple and straightforward. I salute RMS for creating Emacs and keeping it free


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

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

Way of Life

November 15, 2008 at 12:11 pm | Posted in community, Hacking, History | 1 Comment
Tags: , , , ,

People are wrong when they say GNU (FSF) is just a collection of free softwares, GNU is a way of life. This way of life transcends itself from software profession into one’s personal and social life too. The truth is not that when people come in the GNU community then they become good, that they become the ones who think of society first instead like others who think of their selfish business interests based on the proprietary softwares.

The actual truth is GNU is a place which attracts people who work in the favor of the society, in the interest of humanity. GNU is nothing less than unicef , helping both kids and mature people who have a common interest in making technology better so that that technology can be used to put humanity on the forefront of innovations. When GNU was founded it gave a platform to all the people who were working on different places all across the different nations, to come under one umbrella, the Free Software Movement.

For me, GNU worked liked Red Cross. I have worked for 5 years with Windows, 3 years in college plus 2 more years at home and when today I compare my learning in Windows with just 2 years of working with Linux I see, I am much more of a man with common-sense about software. Windows is an Operating System which kills your senses, and so are all the other proprietary Operating Systems. They kill your senses. It is like you purchased a Motor Cycle and you don’t know where are its spark plug and Petrol Tank. When it stops working, you go to the Manufacturer and he charges you $100 and then tells you that your Petrol Tanks is empty, please fill it and then it will work. It is exactly same in the case of support from Proprietary Softwares. GNU gives you the complete Motor Cycle like as it exists today, you can see where is the engine, where is the spark plug and when trouble happens, you can open them and look for the solution. You can think of the fully-covered machines and then can imagine where our development have been gone if it was like that. The technology must remain open for everyone to study , so that they can spend their time on understanding problems and offering solutions. This is what exactly Free Software community does and I think this is what exactly GNU does. Making money and keeping technology patented are two very-very different things. Corporations are making money on both GSM and CDMA technologies while GSM is open and CDMA is patented. In fact, 82% of the Mobile market is owned by GSM, an open standard. I don’t understand why companies making proprietary software get so baffled when someone talks about Free Software in front of them. For becoming the leader of the market and #1 in business, your competitors need to go out of business. You do that by solving some problems which are unsolved yet, by changing your way of doing business, by offering some service to your customers, services that seem very simple and general but never done, by looking at the domains that are not understood by pointy-haired bosses. Google did that same, it solved the problem of searching, it solved some problems of e-mail. If you will look at the history of corporate you will find many examples conforming my viewpoint.

Business means making money, by either hook or crook. Unfortunately, general public does not want to understand this, an average man avoids an understanding of his surroundings all the time. He spends 30 years in his job, yet never tries to understand why he is there doing his boring job. He never asks himself what will happen to the company if no one does his kind of job. He never tries to understand his place or the place of his seniors in the company. If one tries to do so, he will get fed up by the so less power he gets in his current job, he will get impatient by thinking if his job and comparing it with what he can do, what he could have accomplished in last 5 years. Many people are afraid of doing business in first place, that fear is nothing, the fear of loosing is just plain nonsense because if you don’t get any risks, if you don’t have any insecurity, you won’t get anything worthwhile (e.g. having 10 million dollars in your bank account is one worthwhile thing, while the other worthwhile thing from my view point is I can buy nutritious food and make my body strong) . One can also make money by not harming the society. One can make money by making the society, the surroundings a better place to live. There is no need and there is no point in using political tactics to gain power in business. It is like that we have create a different type of business-model while keeping it more-profitable than current models. Besides that when one works in interest of his people, he will not know, how many people will be helping him. There will be communities working day and night to support such a business. One of those organizations is GNU.

GNU is not only about software. Its about making lives better. The people from the Free Software Community are not the onle ones who can become great Hackers (a.k.a great programmers), they are also the ones who can become great politicians, innovative businessmen and global leaders. I know most readers will not understand that. GNU uses software as a primary way to express itself. How do you express yourself ? GNU is about living for a cause, GNU is about Freedom, GNU is a about living your life the way you want, the way you truly are, not the way some boss thinks you are. GNU is the way of life, GNU is inside you, GNU is a mirror all you see in GNU is just own reflection. GNU is not only about software, its about Freedom of your inner self from all the chains. GNU just hands you a tool that sets you free. GNU is a way of life.

 

 


Copyright © 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.

Do you have Loveware ?

October 16, 2008 at 6:32 pm | Posted in community, Hacking, History | Leave a comment
Tags: , , , , , , ,

Its been a longer time since I read about The GNU Project or The Conscience of a Hacker. In year 2005, in the month of March, my life was hit to a great degree by a piece of text I found on some weired, strange and difficult to learn text editor knows a Emacs. I hit some combination of keys to get help and got a project description including autobiographic expressions instead of help page. I read it, I read it and I read it again and again and it took me. I was enlightened . It had to be 4 more days and then next 6 months before I was going to be enlightened again 2nd and 3rd time, again by 2 piece of text respectively. I can’t forget these 3 days for all of my life. GNU Project and GNU manifesto showed me something I never knew existed and Hacker’s Manifesto showed me my own reflection, the beliefs, the fundamentals of life I was living for. As my responsibility to fellow Hackers . I am posting the complete text of GNU Project and A Hacker’s Manifesto here. They were not written by me and hence I don’t own the copyright of them. If you want to do something with them, please do some Googling ask the appropriate persons. I call them Loveware, a word I invented myself, primarily inspired from Infoware as for people who oppose love there is nothing more fatal than a man in love who has taken the stand and same way these 2 articles are revolutionary in Software. Great Programmers do software because they love programing, they love Hacking, they love information. Same way many of them love these articles, including me. I call it Loveware, for it is the only Love I found except of my family and Martial-Arts. Hacker say Impeach God and May be the source with you. I go one step ahead, God is an unpractical concept and Lets only live with the source, why we need to “may” ?

If you really are a programmer and live and breathe software, you need to go ahead and spend next hour in reading these 3 articles. It is the only reason I have provided their links. So, now I should ask, what exactly is Loveware ?

The GNU Manifesto is Loveware, The Conscience of a Hacker is Loveware. The Hurd is a Loveware. When Paul Graham writes about Lisp, it is Loveware. When Bruce Sterling authored The Hacker Crackdown. It was Loveware. Love lies inside a Hacker’s heart, it lies inside everyone who loves programming, who loves to explore. It sets you free and Loveware is which makes the environment surrounding software folks different from all other professions.

 

 

Copyright © 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.

Create a free website or blog at WordPress.com.
Entries and comments feeds.