Introduction to Programming Languages
Introduction to programming languages
What is a programming language?
Code has to be created in a way that allows for the computer to understand and process it. This is where programming languages step into the picture.
All programming languages have the same purpose: they are there to make it possible for us to create programs, software and applications. Since a computer only understands binary code consisting of only zeroes and ones, we need a tool that makes it easier for us to communicate our instructions to the computer.
Programming languages allow us to write code that is relatively easy to write, read, and understand. However, each programming language is different when it comes to how the code actually looks like, or the syntax.
For front-end development, the most important programming languages are
- CSS and
To be precise, HTML and CSS aren’t actually programming languages, but markup languages instead. We’ll get back to this topic when we discuss programming language paradigms in Chapter 3.
For back-end development, some of the most used programming languages are
- Programming languages allow computers to understand instructions from the programmer
Why are there so many programming languages?
Each programming language is designed to serve a specific purpose. Some are used for creating desktop software, some are useful for web development, while others can be used for data analysis, for instance.
Therefore, each programming language exists to solve a problem for us who use it. Simple as that.
The characteristics of each programming language in terms of how it works and how “evolved” it is is called a paradigm. For example, you can differentiate between low-level and high-level programming languages, both terms referring to programming language paradigms.
Low-level languages are closer to the binary code a computer can understand.
High-level programming languages bear no resemblance to binary code.
Therefore, high-level languages are easier to program in, especially for beginners, since they can even read a lot like English.
- Each programming language is designed to serve a specific purpose
- Paradigms refer to the characteristics of programming languages
How is a computer program written?
A simple computer program is simply a text file written in a certain programming language. Each programming language has its own rules as to how the program should be written. These rules and practices constitute the syntax of that specific language.
Moreover, the code written inside a program file is called the source code.
To create a program, you simply write the code using a plain text editor like Brackets, Notepad++ or Sublime Text and save it on your computer.
We’ll take a closer look at text editors later this chapter under Useful tools and software for coding.
How is a computer program executed?
Once you have written your program in your text editor, you surely want to see how it works, right?
To do that, you will choose a platform for running your program depending on the programming language you are using.
Other languages can be run directly in the Command Line or in another software.
What happens when you run a program?
So when you run the program you just coded, what is really happening behind the scenes? How does the computer know what to display on your screen?
A computer only has an understanding of either “off” or “on”, either 0 or 1. So to actually run your program, it first has to translate all the code you wrote into a series of commands of ons and offs.
The computer does this in three steps:
- First, the source code is translated into assembly language.
- Then, the assembly language is translated into machine language.
- Finally, the machine language is directly executed as binary code.
To be more precise, assembly language is a very low-level language that uses words and numbers to represent binary patterns. Furthermore, it depends on the programming language whether this source code translation into assembly language is done by an interpreter or by using a compiler. An interpreter translates your computer program line by line, while a compiler translates the entire program as a whole.
After this, the programming language sends the assembly code to the computer’s assembler. It in turn converts it into the machine language that the computer can understand and execute as binary code.
- Code for programs is stored in text files
- Computers only understand binary code consisting of zeroes and ones
- Running a program requires the source code to be translated into assembly language, which is translated into machine language, which in turn is executed by the computer as binary code
When you think about it, it’s pretty awesome how something as complex as your online banking or your favourite social media can run based solely on binary code, ones and zeroes!
Feeling a bit confused? Don’t worry! By the time you reach the end of Chapter 3 you will already have chosen your first programming language to learn.
In the next part of this chapter, you will learn about the different building blocks of websites and other web projects. Reading about the differences between front-end and backend development, you will get a better idea at what all these different programming languages can do.