- Computers & Software»
- Computer Science & Programming
How to learn any Programming Language
Introduction and disclaimers
I still recall my days of first year in B.Tech when I hated 'C' language most. The reason were quite obvious: I was completely unaware of the way computers worked. Yes, I was an illiterate in terms of computer language. The second thing which fueled my dislikes were my mates. They had already learnt the language and hence the teacher never cared for the students like us.
Oh ! I am sorry if I flooded your brain with my retrospection. But I started this hub by outlining those feelings which might have brought most of my readers, if not all, to read my hub. I will in this section outline some prerequisites which according to me are important if not an absolute necessity.
The first, that is required for a programming is lots of patience and calmness. In the early stages you will be assigned very short programs but as you begin to delve deeper into the topic the complexity and the length of a program increases considerably. Hence it is the reason I asked two things from you. Patience leads to completion of lengthy programs and calmness aids in dealing with complex programs.
You must be interested in logic and rationale. Although it`s not a very stern requirement since it can be developed gradually as you move further into the subject. As you learn further you come to know about various sorts of programming problems which gives you great insight in the way mathematics works.
The last thing is optional but I urge that you must develop it. This is diligence. See, if you love programming then it is inside you but if you not, you must develop it if you want to learn programming. The programs, sometimes, become very long and very intricate. Here is where the diligence comes into play. If you have taken care of every thing entered then it`s fine but if you have not(which means that you are not diligent) it will be very hard for you to debug the program.
I think I have made my disclaimers and now I will commence the methods by which one can easily learn programming.
A Humble note
Here I have described the methods which greatly focus on basic programming languages such as 'C' and Assembly language. Of course! since it`s only a beginner who seeks guidance for learning a new language. Once he becomes adept in basic languages he himself is capable of mastering over any new language that comes before him to learn.
Why do we need to learn programming ?
I have seen many people, in fact even I complaint when I did not knew this wonderful language, complaining that why do we need to learn this language. The ones who are already charmed with the programming and understand why do they need to learn programming may skip this section. This section is for those who are skeptical of programming language(Mostly C) which is in the part of their curriculum in their graduate studies.
The first reason you need to learn programming is because you are living in world affluent with technology. What ever your major be you cannot avoid computers. Hence, to execute many tasks it becomes easy when you know programming. Suppose you are from engineering stream, in the first year-- since you do not understand your course and way industry works-- you complaint: "I am not a computer science student then why the hell I have to learn this language."
I understand your emotions but I will tell you that since now you have selected to become an engineer, there is hardly any stream where there is no design and analysis. Taking the case from the Electronics & Communication Engineering, there are many languages which almost follow C. Hence you must know programming to be comfortable with the languages when they suddenly come before you as you proceed towards the end of you bachelor course.
The second reason is the simple fact that programming makes you an expert in the area of applications. An engineer and a theoretical researcher are not very different except that engineer knows the method to devise lots of applications from the theory he has learnt in the college.
Programming is the greatest tool to implement various applications. You will see the power of programming yourself once you begin to get serious with it. But for now I will outline some instances of programming, when it comes to assist one with great capabilities. In 8085 Assembly language programming there are small instructions which help one to make counters and these counters come as invaluable building blocks to design various clocks. These types of clocks are used in operating the traffic lights which you normally see when you go in market, if you are a city dweller.
All modern research is carried out with some software and you need to know how to operate them and you cannot directly master them until you know basic concepts of programming. A Good example of research platform is Matlab. Currently I am pursuing my research on digital communication through this tool. Others that might interest you are TSPICE, HSPICE, Xilinx etc.
Programming is the basis automation
What is Programming ?
The best way to gain mastery over anything is know what is it all about ? I will briefly explain what a programming is. Programming is set of instructions given to the computer to carry out a particular task. Suppose, you want to find out the cube of a number. Yes, you can do it manually but your computer may do it much faster and more accurately than you. This is where the programming comes into the play. You enter a number and the computer gives you cube of that number. Now you can have a feel of what a programming is ? You see that when you entered a number(known as input) the computer performed the task of finding cube of the entered and gave it to you. The number given by the computer is known as output.
The second thing that you can assume is that programming is like a function or machine. What a machine does ? It takes some input from you and then yields an output. A good example is of a juicer used as a home appliance. What it does ? It takes some vegetable and fruits and yields their juice. So you can confidently assume that a Programmer builds a virtual machine on a computer for a particular task.
One delicate point that you would have found out in the above paragraphs is "process". Yes, though not every time but almost all the time we program to describe a process. This method of programming comes as a great aid and we can exactly analyse the process by looking at its output and input.
Programming has two things of which I will give here a brief introduction. Design and analysis. What is design ? Design is to build a process, function or structure in order to yield a desired output. Heed and mind the above sentence. Desired word is of very much significance here. Designing is making a machine which behaves in way as to satisfy the needs of a particular user. Suppose a customer comes to you and says that he want a fan which must run on such and such speeds and must stop automatically after this time. Now, then, you can design a program to meet customer specifications.
What is Analysis ? Analysis is almost reciprocal of designing. In Design, you were given the output and you had to make a program such that it conforms to the output as desired by the user. But in analysis,.you are given a process and you have to analyse it by observing the output and input of the process. You will learn more in higher classes, if you are pursuing your graduate studies in engineering stream.
Matlab is a powerful programming platform
Best C Compiler for C Beginners
Beginnings of a new language
What ever you wish to become I strongly urge that if your final aim has something to do with technical works on computers, do learn C language. Most of the people now belittle C and claim that it has been, superseded by more advanced programming languages. But I will refute them, C is highly revered as the mother of all programming languages and it will make you accustomed to the behavior of computer. After you have mastered it you will find that it has become easy for you to understand how a machine works.
The second reason that I give is that if you are a guy pursuing your Bachelors in Electrical Engineering stream than you will find that most of the industry tool use this language. The examples are Embedded systems and Matlab. And all the other tools become much easier to comprehend and master if you have already learnt 'C' language.
Download C compiler for free
- Download Turbo C++ 3.0
Turbo C++ free download. Get the latest version now. This is a free C++ compiler from Borland. It comes with an IDE and debugger.
Reason to learn Programming
Why have you decided to learn programming ?
A Good Book is no less than a Boon
Since most the things I have learnt by myself in my life and hence I have firm believe on self dependency. To learn programming in an interesting way you must be very careful in choosing a good book. I have found, in my academic career, that most people do not give regard to selection of book and later on complaint about the dullness of the subject.
Always prefer the books while learning any programming language introductory books. The reason for it is that they explain you in a friendly way and do not expect much from you. For 'C' I will strongly recommend Yashwant P Kanetkar`s Let Us C. It can be correctly pronounced as the Bhagvat Geeta of 'C' language. Every thing has been in so simple and lucid way that one cannot prevent but fall in love with C language.
For assembly Language programming the best book is
Microprocessor Architecture, Programming, and Applications with the 8085 . It is a marvelous book which starts with a,b,c of a microprocessor and in the end makes you a master in the area of 8085 microprocessor.
Order 'Let us C' now
The best book to learn C language
Father of 'C' Language
Implementation of 'For' loops in C Language
Freedom of time
I recommend that whensoever you start learning programming, always make sure that you can expand the amount of time needed. What I mean to say is that if you have got a tight schedule in your daily life then I recommend that you chose the time when you have lots of idle time.
What happens most of the time while programming is that you generally become so engaged in a particular problem and hence you may have to spend considerable amount and hence it is possible that you may overshoot leading to conflict in your planned routine. Hence it is due to this reason that I urged you to chose such a part from your routine.
The second benefit that you get is you learn to immerse yourself in a particular subject. You learn to concentrate and believe that it is this charm that programmers around the world create miracles. A good example is of Linus Torvalds who himself devised a new operating system named after him, 'Linux'.
A Programmer`s workstation
Make a Prototype
A prototype is a primary structure or a skeleton of any function that is to be implemented via programming. The flowcharts and block diagram can be considered under the ambit of a prototype. Most of the students try to implement the program directly which is acceptable in simple cases but as the complexity and your knowledge of the language increases it becomes important for you to manage your resources and apply them while programming.
So, it is better if you learn to use flowcharts accurately while designing your program. The other benefit you get is fast debugging(It is a process in which a programmer rectifies the errors of his program). The other benefit that you get is the firm command over the whole process which is taking place in your computer. You are ascertained that output is correct, since you can easily verify it from the flowchart.
A Modular Approach
This may not seem very obvious to you at first but when you go on implementing lengthy programs then this habit becomes highly commendable. Let us now get a good look of what a modularity is all about ?
'Modular' is a word derived from module. A module in a program is a particular sets of instruction which performs a particular job. There are many benefits which are outlined below :-
- The first benefit one gets is easy integration of the program. And remember this is not only for the lengthy programs but they are equally good for short programs.
- In C you will come across a chapter named 'functions, there you will appreciate the role of modular approach.
- Your Program is well defined and hence it becomes easy to debug it based on the nature of output.
- The last but not the least benefit that I can suggest is the addition of piecemeal which enhances the versatility and generality of the program can be easily accomplished through modular approach.
Feedback is a very powerful tool
I don`t know from which background my readers are hence I do consider it as a necessity to explain what I mean by the 'Feedback'. By 'Feedback' I mean that do not try to finish an error-free program in one go. Instead I would recommend that you, as a beginner, implement the structure of the program and the add necessary elements to the program. A good example from 'C' language is when you need a new variable. While some people prefer to declare all the variables in advance, it is better if you declare the variables as you need them.
The benefit of this method lies in the fact that you save your program from redundancy and errors which might occur due to injudicious use of variables. Also as a result of this approach, you don`t have put all your energy. Your run the program and verify the output, if the output matches with the theoretical outcomes then your program is fine else it has some errors which can be easily corrected by observing the nature of the output.
Remember this method of checking and correcting program works only for the cases in which theoretical result is known to the user in advance which is indeed a truth for beginners. But in high level projects you may have to desert this habit since you may not have the courage and patience to run program many times.
I have described the methods which make programming a fun and never I waded into the complications and technical aspects. The reason for this is very simple. Those writers whom I have attributed know much better then me how to explain all the terms and details of the language.
I have just described the approaches by which I easily learnt programming. I will continue to add my experiences in this hub according to the response I get from my readers. Any sorts of criticisms are welcome.