Now how will you program a computer? 0101...? Let's learn the easy way, the programming language!
Welcome to the Newbie Programmer Series. In this post we will learn more about the programming languages. In the previous part we discussed the applications of the computer and for that we have to program it. Let's learn in detail how it all works. If you are new to this series please go to the index (click here) and read out all the previous parts so that you can easily understand what I am talking about.
To teach a computer how to do our work, we have to program it. During programming, what we are actually doing is that we provide our intelligence to the computer and the computer uses its accuracy, speed and memory to do our work efficiently. Also note that a computer do not get tired like us so that's an another plus point of using a computer (until the heat fans are working properly!)
So let's begin!
History of Languages
I wrote in the last part that a computer can understand only 01010101... What's that?
Inside a computer, there exists electronic logic gates (don't think too much, it's not for our interest). They act as switches but intelligently, they can be used to do logical operations. Like switches, we can turn them ON and OFF. We have defined ON as 1 and OFF as 0. We use these 101010100...(whatever) sequence as codes to communicate with the computer directly. This number system of zeros and ones is called the Binary System and there exists many other number systems like this. And a computer can be programmed with such number systems. We can instruct the computer to turn ON and OFF certain electronic things inside itself and can use it for our work. Coding with such number system is called the Machine Code. As it can be read and understood by Machines.
Do you want to see how a machine code look like to us ? Select any executable (*.exe) file. I mean the main file that run your program, your games etc. Open such a file in Notepad. For example I opened the chrome browser in notepad. See whats it looked like.
A .exe file in Computer's language
The unreadable scrap you will see is what I am talking about.
Later an easier coding system was developed called Assembly Code which make some sense to humans as it have some words in it as short cut commands or mnemonics to the machine codes.
To The Modern Programming Languages
With the development of the computer and its applications, we now require easy and quick ways to program a computer. Assembly and Machine Coding both are very hard and time consuming and also the one who is using these coding styles to make their program needs to know a lot about the internals of the computer in the electronic sense.
What we want is that we write our program in English like language and it get translated to these ones and zeros. Therefore now a days, we use the Modern Programming Languages. These are real Languages not just codes. Usually we can use the words of English but have to follow the Language's own grammar. Yes. Different Programming Languages have different grammar and rules.
Let's take an example. BASIC and C are the two of most popular programming languages. To write a program that can say "Hello" on the screen, we do...
While in C
You see, we have used all the words in English but how some rules are different. If we do not follow these rules, it will be considered as an error and our program will not work. Some programming languages have very hard grammar. In the above example, you will find the C Language hard but that's not so. These rules are their due to some reasons and that makes their use better. Different Programming languages have different purposes too. We can choose any programming Language based on our needs.
Just like Sanskrit, English, Japanese all are different languages, have different grammar, origin etc but we cannot say one is better than others. They are all best in their own areas. Similarly different programming language are best in their own purposes.
A Homework for you!!!
I found a great website, helloworldcollection.github.io . It contains the list of the famous "Hello, World!" program in different languages. Checkout how different languages are used to make the same program. And don't get threatened by that article. I am linking it for fun only.
That's how we have put our legs into the world of programming languages. Throw all of your fears about programming because in the next post, out of hundreds of such languages, we will discuss the programming language that we will use in this series. In the next post we will also setup our computer for the programming environment and you will write your first program too. So the next post is very interesting. Stay excited and connected.
Please share this as much as you can so that we can get connected with more and more people who want to learn programming.