Home > Programming > Types of Programming Languages

Types of Programming Languages

November 16th, 2008 Leave a comment Go to comments

What we know so far:

  • We use computer programs to tell computers what to do
  • Computer programs are written in languages that are translated by the computer
  • Every computer program deals with data and instructions performed on the data
In this post we’re going to talk about a few different types of programming languages.
The first computer programs were “written” directly in computer language. I put “written” in quotes because a lot of these programs weren’t actually written the way I’m writing this blog post – they were created using much more complex methods, like punch cards. Nevertheless, this wasn’t even the hardest part. In order to create the program, the programmer had to know computer language directly.
This was presumably way too hard even for very simple programs. So the next step was to create a higher-level language. There are many variants of this language, called “assembler.” I actually had to learn assembler in college, and believe me, it is hard to imagine that it is actually easier than machine language.
As programs became more and more complex, even assembler was eventually much too complex to be able to use effectively. Higher-level languages were created to help out.
One characteristic of these newer languages is that the code is translated into machine language before it is executed. Special programs are used to do the translation. These special programs are called compilers – they compile the written program into something the computer can execute and run. Computer languages that have to be compiled before they can be executed are called compiled languages.
Many common early programming languages are compiled languages, such as COBOL and FORTRAN. Over the past thirty years or so, one of the most commonly used compiled languages is simply called “C.” C, and popular variants of C like C++ and Objective-C, have been used for years and are still very popular today for applications you use every day. Most computer games, most popular operating systems in use today, and most of the internet runs on C or a C variant.

Programs written in compiled languages tend to be very powerful and to execute quickly. The compiler effectively converts the code into machine language so the machine can execute it directly when it runs. Compiled languages are often chosen for applications where high performance is a factor.

One drawback of compiled languages is that they will only work on the computer platform they were built for. An application written in C, once compiled on Windows, will only run on Windows. To run it on a Mac, you would have to compile the program again on a Mac.

Another drawback of compiled languages is the need to compile. Every time you make a change to the program, you have to rebuild the program in order to test it. For large programs this can become somewhat tedious and time-consuming.

As an alternative, we have interpreted languages. Interpreted languages are, in many ways, the opposite of compiled languages. Interpreted languages don’t ever need to be compiled at all. Instead, a program called an interpreter will translate the program to machine language as it is running. Essentially, with an interpreted language, you tell the interpreter to run a program, and it translates that program and runs it for you. Perl, PHP, Ruby, and Python are all examples of interpreted languages used today.

Since interpreted languages don’t have to be compiled, the turnaround between editing and testing is much quicker. However, since they are translated into machine language every time they are executed, programs written in interpreted languages do not generally perform as well as a comparable program written in a compiled language. Still, they are very popular, especially for things like web applications – many web applications are written in an interpreted language.

Another advantage of interpreted languages is that they are a bit more portable that compiled languages. As long as a Python program doesn’t perform any platform-specific tasks, that program can be executed on any platform with a Python interpreter.

So, there you have it. On the one hand, you have compiled languages, and on the other, interpreted languages, opposites of each other in many ways. As I continue this tutorial, I’m planning on teaching you to program in both C and Python, so you will get a little taste of each.

blog comments powered by Disqus