Programming languages are similar to spoken languages in that they communicate concepts. In the case of programming languages, they communicate to computers in terms of actions to perform.
There are literally hundreds of languages of which 5 of the most popular are described below. But before we get into that, it's important to understand how a language works and interacts with a computer.
Ultimately, a computer only understands a language called Machine Language, which is made up of only a bunch of 1s (ones) and 0s (zeros). If you physically open up a computer, you'd see an array of computer chips and a highway of tiny wires between them:
At any one time, some of these wires have a very small electrical
current running through them while others do not. A machine language instruction would tell
the computer which of the wires to turn on (1) and which ones to turn off (0). So if you had 4 parallel wires and wanted only every other wire turned on, the machine language instruction would be something like "1010" as follows:
Different combinations of these 1s and 0s tell the computer to do different things. In reality, as you can see in the above circuit board picture, computer chips have many more wires to them. So it would be quite laborious to program in 1s and 0s. Besides, programming in machine language would look something like this:
Not very understandable is it? And definitely not fun!
So programming languages quickly became more English-like so we could read and understand them. The following is a little program written in the BASIC programming language:
PRINT "Hello, world!"
PRINT "I'm learning to program in BASIC."
PRINT "I'm using the PRINT command to print this line."
PRINT "Now my program is over."
As you can see, this is much more understandable to the human. But how does the computer understand this?
Well, there is a computer program called a Compiler. A compiler compiles or converts an English-like programming language into machine language that the computer will understand. There are different compilers for different programming languages.
In a very simple sense, once you write your program, you run it through one of these compilers and out pops an executable - a computer program that executes your instructions.
Some programming environments don't use a compiler per se. They use a built-in interpreter. An interpreter compiles one line of code then executes it, then compiles another line and executes it, one by one in sequence. You don't see this occurring. You just execute your program and this is all done "in the background".
Most programming languages today are called high-level languages as they are more English looking. Languages that resemble more computer-looking instructions are called low-level languages as they are closer to what the computer understands.
Procedural Programming Language
A procedural programming language is a language that enables a programmer to segment their program into blocks of code called subroutines, functions or procedures. Each of these routines has a particular task such as "multiply two numbers". The main program body makes "calls" to these routines in order to efficiently achieve its overall task. The code is segmented in this way as there may be multiple times where the main program body may need to multiply two numbers. One would not rewrite the multiply-two-numbers code each time it's to be used. Rather just call the multiply-two-numbers routine when needed. The following 'C' language example shows how this works:
void main() // main body start
int variable1, variable2, result; // define some variables
variable1 = 25; // assign variable1 a value of 25
variable2 = 10; // assign variable2 a value of 10
result = multiply-two-numbers(variable1, variable2); // call
} // end
/* subroutine definition block */
int multiply-two-numbers(int var1, int var2) // define routine
return var1 * var2; // multiple the numbers
Object Oriented Programming
c programming language
java programming language
basic programming language
python programming language
ruby programming language
c sharp programming language
list of programming languages
history of programming languages