Programming like an Indian
I always thought I had some really good concepts in programming. I tutored for many years professionally with my students achieving excellent grades all the times but I never got to write what goes behind in my idiot-box. So, I am taking this time to share my thoughts as I sit down to write a program. This is for complete novices in programming and for those who are interested in taking a peek into the basic thought process of another programmer.
All corrections to this article are most welcome as comments.
What I don't like
I have seen so many students and friends memorizing programs and logics to solve problems. I must make it clear that if you are serious about being a good programmer, you have to get through this article understanding the importance of basic concepts.
Introduction
What is 10+3? It's 13. Just to come up with that, unknowingly you recalled the meaning of '+' and what it does to numbers, something you probably learnt decades ago.
What is 10245 X 36? Now, most likely you are thinking of a calculator. So, you find one, you press the number followed by 'X' and another number and then get the result.
What just happened? The calculator knows just like you that 'X' means to multiply. The only probable difference is that behind the screen it will take the calculation as an addition of 10245 to 10245 and 10245 and 10245.. 36 times. Because it is programmed to behave in a specific manner when a specific sets of buttons is pressed.
Let's see an example thats even simpler: that of a vending machine.
I want a coke, I put in a dollar coin, press the coke button and get the coke out. Whne you press that button, the machine recognises it as an action-command for itself and then returns you a coke. Quite similar to the caculator that persieves the '=' pressed as an action button for it to give result. Both the results require an input: whether it's two numbers with a 'X' or a dollar coin with a coke selection.
We can thus far establish that program in someone's head, or machine's circuit, or calculators chip is nothing but a perceived input followed by some processing and eventually a result. It tremendously helps the budding programmer to see how things around him are programmed. How so many things can be modelled based on the INPUT-PROCESS-OUTPUT model of a program.
Crazy Examples
I want to emphasize on the importance of seeing real world's physical dynamics as programs and therefore give more examples of programs:
1) There is a program in a plants head which helps it to know that the soil has water and the sun is shining and the air is present, and given all these inputs, it is time for the leaves to start making food. Food which makes the plant grow.
2) There is a program in the head of a snake that tells it to look out for warm blooded animals. And when it does sense one, the program makes it pounce on it as the required action or process and the output is that the snake is full and it grows bigger.
What does that sound like? Every process, every habit, every event and function can be seen like a program. Most important thing is to understand that process to be able to identify the steps that define it. There we have the string to connect to the introduction of algorithms.
-----------------------------------------------------
This same section will be expanded. So, do keep a lookout.
TBC.
-Naveen Kumar
http://uglymoth.blogspot.com/
I always thought I had some really good concepts in programming. I tutored for many years professionally with my students achieving excellent grades all the times but I never got to write what goes behind in my idiot-box. So, I am taking this time to share my thoughts as I sit down to write a program. This is for complete novices in programming and for those who are interested in taking a peek into the basic thought process of another programmer.
All corrections to this article are most welcome as comments.
What I don't like
I have seen so many students and friends memorizing programs and logics to solve problems. I must make it clear that if you are serious about being a good programmer, you have to get through this article understanding the importance of basic concepts.
Introduction
What is 10+3? It's 13. Just to come up with that, unknowingly you recalled the meaning of '+' and what it does to numbers, something you probably learnt decades ago.
What is 10245 X 36? Now, most likely you are thinking of a calculator. So, you find one, you press the number followed by 'X' and another number and then get the result.
What just happened? The calculator knows just like you that 'X' means to multiply. The only probable difference is that behind the screen it will take the calculation as an addition of 10245 to 10245 and 10245 and 10245.. 36 times. Because it is programmed to behave in a specific manner when a specific sets of buttons is pressed.
Let's see an example thats even simpler: that of a vending machine.
I want a coke, I put in a dollar coin, press the coke button and get the coke out. Whne you press that button, the machine recognises it as an action-command for itself and then returns you a coke. Quite similar to the caculator that persieves the '=' pressed as an action button for it to give result. Both the results require an input: whether it's two numbers with a 'X' or a dollar coin with a coke selection.
We can thus far establish that program in someone's head, or machine's circuit, or calculators chip is nothing but a perceived input followed by some processing and eventually a result. It tremendously helps the budding programmer to see how things around him are programmed. How so many things can be modelled based on the INPUT-PROCESS-OUTPUT model of a program.
Crazy Examples
I want to emphasize on the importance of seeing real world's physical dynamics as programs and therefore give more examples of programs:
1) There is a program in a plants head which helps it to know that the soil has water and the sun is shining and the air is present, and given all these inputs, it is time for the leaves to start making food. Food which makes the plant grow.
2) There is a program in the head of a snake that tells it to look out for warm blooded animals. And when it does sense one, the program makes it pounce on it as the required action or process and the output is that the snake is full and it grows bigger.
What does that sound like? Every process, every habit, every event and function can be seen like a program. Most important thing is to understand that process to be able to identify the steps that define it. There we have the string to connect to the introduction of algorithms.
-----------------------------------------------------
This same section will be expanded. So, do keep a lookout.
TBC.
-Naveen Kumar
http://uglymoth.blogspot.com/


0 Comments:
Post a Comment
<< Home