When it comes to programming languages, there is a plethora to choose from. Moreover, there are tons of them out there for different applications. The primary function of a computer program is to solve a problem with a set of given instructions (or code). However, if all of them can solve problems, why is there a need for so many? Can’t one program do it all? To answer these questions, let’s look at what it takes to execute a computer program.
Hardware that Computes the Program
Almost all computing of any nature (with a few exceptions) is done in the Central Processing Unit (CPU). The modern-day CPU that we have today contains many microelectronic components. The CPU can be further divided into smaller computing units known as Logical Transistor Gates, commonly known as logic gates. The primary function of these logic gates is to implement three primary operators: AND, OR and NOT gates.
The above logical operators work on a number system known as a binary, which works on a numeric system of only 0s and 1s. 0 signifies no electric current passing through the transistor, and 1 implies that there is an electric current passing through the transistor.
The most bizarre phenomenon is, if you combine just the above logical operators with binary, you will be able to express all of the logic we know, including arithmetic operations, integers, and almost everything else you can imagine. A modern-day CPU has something called a microcode preinstalled within it. A microcode contains a set of basic instructions used to carry out more complex executions, known as machine code.
Levels of Software for the Execution of Code
Now that we know the hardware behind the execution of computer code (there’s much more, but for the sake of simplicity, I will stick to the parts where the main computation occurs), let’s move on to how many levels of software are needed for the execution of the software. The first program needed is the Assembler, which helps in the conversion of the assembly language into machine code. An assembly-level language is a lower level language that acts as a correspondence program between a high-level programming language (e.g., Python, C++, Java) and the machine code. The layout of any software architecture is as follows:
The next important program is the Compiler. The compiler takes high-level abstract language and converts it into assembly language, and sometimes machine code as well. The last final program (or package) that brings everything together is the Operating System. The operating system is basically a program that starts when your computer starts and runs until the computer is shut down. The operating system is also responsible for managing complicated tasks, such as file management, input & output management. This functions so that every time you want to execute a program, you don’t have to keep reimplementing it again and again. It also makes the interactions of the user function in a more intuitive way, rather than always trying to communicate with the computer in the form of 0s and 1s.
One Size Does Not Fit All
Now we understand that all the different programming languages go through the same form of execution. One program should fit for all causes, right? Wrong. It would be an ideal world where we only needed one program for everything and anything. All programming languages do serve the same purpose, whether it is C++, Java, Python, etc., but all of them are necessary for different reasons.
What creates the need for different programming languages is that each has a different functionality. When a programming language is created, it is designed with the intention to add as much functionality to it as possible, but there is no programming language that can do everything under the sun. With that in mind, let’s take a look at the different programming languages and their functionality:
- Java: This is a general-purpose software primarily used for Android development. It is also sometimes used in website development and embedded software. It is considered one of the more popular programming languages.
- C++: This is the successor to the infamous general-purpose programming language C. It is currently used for the development of computer games with high-end graphics. It is great at memory management and very smooth during run time. It is also used in developing operating systems and desktop applications.
- Python: Again, this is for general-purpose software. It is not as fast as other programming languages, but it is excellent for website development and data handling. Program build time is much less in Python as compared to other programming languages.
- HTML/CSS: This isn’t really a general-purpose programming language, per se, but it is more specifically geared towards website development. Languages like Python, which are used to create the backend (the part that interacts with the database) of websites, work by sending HTML to the server. HTML provides a structure for the website, while CSS is used for styling and restructuring the website.
- PHP: This is used to add functionality to an HTML program. It allows you to retrieve data and generate HTML in useful ways before it’s sent to a user’s browser to be displayed. Companies like Facebook use this language extensively.
- R: This has become quite a famous programming language in recent years. It’s used exclusively for statistical analysis and things that are closely related to that field.
As you can see, although each of the programming languages is computing some form of data, each has its own use case and functionality. Also, the choice of a language depends on what each person needs and how comfortable they are with the respective languages.