So, what is programming? Programming is to create(or develop) software which is also called a program.
Now, what is a software? Software is just a set of instructions that tell a computer what its supposed to do. A software is everywhere, almost everything needs a software to work!
A programming language is required to develop a software. Without these languages, there are no software!
Now the main question is that What are programming languages and why are they used?
A programming language is just a medium for us to communicate with the computers! Just like we need English to communicate with each other, computers need a programming language to communicate with the user. All the programs must be written in a language that the computer can use.
What are the types of programming languages?
There are three main types of languages:
This is the native language of a computer, its the easiest for the computer to understand. Just like your native language, you must understand in quite easily and be more comfortable with it.
This language is no doubt the easiest for the computer to understand but it is the hardest for the user to work with. All the instructions in this language are in a form of binary code. Which means, all you can use to develop a software is 1s and 0s.
To add two numbers you might have to write the instruction like this:
Programming in machine language can be a tedious process. Its also hard to read and modify a code in this language. For this reason, assembly language was created in the early days of computing.
Assembly language uses a short descriptive word, known as mnemonic to represent each of the machine-language instruction. For example, the mnemonic add means to add numbers and sub means to subtract numbers.
To add 2 and 3 and get the result, your code in assembly language would look like this:
You might be thinking that if a computer only understands in 1s and 0s, how can it understand the the code in assembly language? Your question is pretty much valid and yes it can not directly understand the code made using assembly language. Another program—called an assembler—is
used to translate assembly-language programs into machine code, so the computer can understand it.
High level languages are English-like, easy to learn and use compared to Assembly and Machine language.The instructions in high level languages are called statements.It is also platform-independent, which means you can write a program in high level language and run it on several types of machines. The first high level language was made in the early 1950s.
To calculate the area of a circle with radius 7, your statement in high level language would look like this:
area = 7 * 7 * 3.14
A program written in high level language is called source code or source program. Because the computer can not understand the source program, it has to be converted into machine code. Programs that can be used to do this translation are ; Interpreter and Compiler. They both do their work differently! An interpreter translates and executes a program one statement at a time. On the other hand, a compiler translates the entire source program into a machine-language file for execution.