In this lesson you will learn about different types of programming languages and how those languages are used in the real world.
Types of languages
All programming languages can be classified as high-level or low-level. When you program in class, you are using high-level languages. People who write operating systems and specialized systems dealing with hardware often use low-level languages.
Within each of these areas, both high and low level, there are many different languages. Just like spoken languages, there is plenty of variety. With spoken languages, some use an alphabet (English) and some don’t (Chinese), while others have gender (French) and some don’t (Tagalog). In the same way, programming languages are different in how they are written.
To see just how many programming languages there are, take a look at this Wikipedia page.
- Uses something closer human language
- Less code does more
- Write in a shorter time
- Debug in shorter time
- Easy to maintain when in use
- Access hardware directly
- Lots of code does very little
- Code uses less memory
- Runs much faster
Activity: Exploring languages
When you first started coding you probably wrote the infamous Hello World program. Take a look at the Hello World website, which is a collection of programs written in many different languages. Pick out two languages which you think are high level, and two that are low level. What characteristics made you classify them as such?
Next, check out this online compiler which lets you code in different languages. Pick one of these languages, and do some research online to find out how you’d write a loop that prints out 0 to 9. Use the compiler to test your code.
Translators turn your source code, which is written in a language you can understand, into something that a computer can understand. There are three types of translators, and they do this in different ways. You need to worry about three types of translators: compilers, interpreters, and assemblers.
Assembler and Compilers
Both assemblers and compilers take your source code and turn it into machine code which is an executable file. This executable file is usually what you run what you click on a program to start it. The process is show in the following diagram.
The difference between compilers and assemblers is that compilers start with a high-level language and then turn it into assembly code where it is compiler by an assembler. You can see the in the following diagram how the assembly language is the middle step.
Interpreters, compilers and assemblers all run programs, but interpreters don’t turn code into an executable before starting them. They run a program line by line going directly from source code to output, and skipping the machine code. Compared to a compiler it looks likes the following.
I’m sure you’ve noticed that errors happen all the time when programming. A missing bracket, the wrong symbol, or using the wrong variable name. Other times your program runs, but something isn’t working correctly.
Of the three types of errors listed above, you need to remember syntax errors for your test, but the others are important to know when you’re programming. You’ve probably encountered all these errors at some point when your program won’t work.
The other type of error you need to be concerned with is called a logical error. This sort of error is much harder to find, because your program still runs, but it doesn’t produce the results you expected. This could be because you forget about order of operations, used an integer when you need a float, or made a loop that didn’t reach the length of a list you were working with.
In this activity you’re going to write four different programs, each of which will demonstrate a different type of error. You will need to show a syntax error, reference error, type error and logical error. If you need some help, you can look at this website to get some ideas.
Integrated Development Environments
Integrated development environments (IDEs) allow programmers to be more productive by providing different tools that help format, fix and organize their code. Take a look at the IDE you’re using, and explore the different features it has. How many of them do you use? Are there any that you’d like to know more about?
Wrapping it up
At this point you should have a good understanding of everything in the following video. Watch it as a good refresher over everything covered, and if you find yourself confused in any place, then go back and look at that section again.