Introduction
The TIOBE index measures the popularity of programming languages in the world and has for 20 years. According to the TIOBE index, Python is the number 1 programming language as of November 2021. Another ranking from PYPL shows python also in the number 1 slot in August 2021. It has been fluctuating in the top 5 for a while now.
Why the rise to number 1? I will say that python is a simple language to learn and use. You can use it in cybersecurity, web, and software development roles. There are thousands of available libraries for just about any task you want to do today whether it is robotic process automation, data science and analytics, system administration automation, web applications, mobile applications, omniverse/metaverse applications, and many others. I have not found a language as versatile as python except c.
We will explore the what is the Python programming language in this post but I want to provide some history around programming languages and scripting first so you can understand where Python sits in the scheme of things.
History of Programming Languages
Computers speak in one language called binary, which is a series of 1s and 0s. Inside a computer, you have a microprocessor also called a CPU. A CPU is the brain of a computer. Its job is to process machine code which is a series of instructions that tells the CPU what to do.
Assembly Language
People are not good at writing machine code so in the early day\’s programmers wrote code in assembly language. Assembly language is one step about machine code and is easily translatable to machine code. You had to a super-skilled programmer to be able to write in assembly language. The figure below shows the assembly language and its machine language counterpart.
Source: Link
A programmer would write the assembly code and compile it into machine code through an assembler. It would create a binary that could be run and recognized.
Compiled Languages
In the 1980s, various languages appeared such as BASIC, Fortran, Lisp, Prolog, C, and others. Each language had its own niche. The one language that became extremely popular was C. C was used to create operating systems such as Windows and Linux. Linux is completely written in C today. C is a high-level programming language that uses a compiler to compile machine code. A programmer would write C code and compile it to run on the machine of choice. An example of the Hello World C program is as follows:
Input:
#include
void main()
{
printf(\"Hello World\\n\");
}
Output:
Hello World
The C language was low-level enough to be able to handle any duty from basic applications to more sophisticated operating system functions. The language is still in the top 5 languages because of its versatility. But, it is not an easy language for a newbie to learn.
The C programming language was considered a structured language. A structured language allows for a problem to be broken down into smaller pieces. These small pieces of code can be considered functions or modules.
Virtual Machine Languages
In the 1990s, a new breed of programming languages appeared called Object-Oriented programming languages. Object-oriented languages such as Smalltalk and others were born. The basic idea was to be able to model the real world in objects and convert those models into code. The most popular language of all time was born in the 1990s called Java. It was launched in 1995 by James Gosling from Sun Microsystems. Java is now owned by Oracle today.
Object-oriented programming allows for a problem to be modeled with classes (templates of objects) and then written into code. The goal was to increase the reusability of the code and be able to read the code better if it represented real-world objects.
Java Virtual Machine (JVM)
The concept of a virtual machine was born to allow for better cross-platform support so you would write the code once and run it everywhere. Java is compiled into bytecodes that can be used on different machines. A java virtual machine (JVM) was created for each machine you want to run java code on. Java opened the doors to web applications and regular applications. There are many languages that run on top of the Java ecosystem.
Common Language Runtime (CLR)
In 1998, Microsoft started the common language runtime (CLR) to compete with the Java ecosystem. The CLR is a virtual machine that you can create code in different languages such as the most popular Visual Basic and C#. The programmer creates code that compiles to bytecodes. The CLR then runs the code on the machine it is targeted for (mostly Windows computer even though you can run programs on Linux today).
Scripting Languages
Up to this point, we have explored different popular compiler languages. There are other areas of programming languages that are interpreted. What does that mean? A programmer writes a script and then runs an interpreter where it runs the script one line at a time at run time. There is no compiling done first. Scripting languages are not as efficient as compiled languages but they can be easier to learn to work with. There are hundreds of scripting languages that exist in the world today. We have explored a few scripting languages in previous robotic process automation (RPA). Those are also considered scripting languages. We are going to focus on just one called Python.
Python
Python is the most popular scripting language in the world. The reason is that you can do just about anything quickly and efficiently in Python. It is one of the easiest programming languages to learn and use. According to python.org,
\”Python is a programming language that lets you work more quickly and integrate your systems more effectively\”
An example of a simple Python script is as follows:
Input:
>>> print(\’Hello World\’)
Output:
Hello World
You can try the program by clicking on the >_ button on the python.org web page, follow the steps below.
Steps
1. Navigate to python.org.
2. Click on the >_ button.
3. print(\’Hello World\’)
4. Hit the return key
The result/output will appear underneath. The result is shown below…
Three ways to run Python code is through the interpreter or using an integrated development environment (IDE) such as pycharm to write the code and run it from the IDE. You can also use a text editor to create the code, save it with a .py extension and run it at the command line such as python helloworld.py.
Compared to the C code above, it is one line of code. You will get immediate productivity gains when using python but you do get a performance penalty. For today\’s computers, the performance penalty is not as significant as it used to be. Python provides libraries for system administration, web development, traditional applications, mobile applications, data science and analytics, AI/machine learning, automation, and many many others. You can use Python to do just about any task you need to accomplish in today\’s world,
Conclusion
In this post, we explored a brief history of programming languages along with understanding the differences between assembly, compiled language, a byte-code language, and scripting languages. We focused on the Python scripting language but in reality, there are hundreds and maybe thousands of scripting languages that exist.