What is a Programming Language?
- Programming is a simply way for us to give instructions to the computer.
- We give it an instruction manual and the computer follows.
- Without code, computer programs wouldn’t do anything.
- You wouldn’t able to google things.
- You wouldn’t able to move the mouse and click around the screen.
- You wouldn’t able to play games like Angry Birds 😡 on your smartphone.
The need for a programming language
- You see computer doesn’t understand English or any other human language. Then what language do computers speak?
- Computers speak Ones and Zeroes (1010111001).
- All electronics speak that language of ON or OFF, Zero or One.
- But writing Ones and Zeroes would be gibbrish for us. And it’s hard for us to communicate like that, right?
- So, humans have created programming languages that are in-between human language (like English) and machine language (like zeroes and ones).
- Some programming language are lower level and closer to machine language.
- Others programming languages are higher level and closer to English (human language).
- And there are lots of programming languages.
- There’s Assembly programming language that is really really close to machine code.
- You have programming languages like Python and JavaScript that are really really close to English.
- Just give you an understanding of how many programming languages are out there, here’s a fun & deep video on the “Programming Iceberg” from Fireship YouTube Channel: God-Tier Developer Roadmap
The Big Picture
Now, if you are wondering how a programming language is fitting in the big picture of day-to-day computer usage, here’s how:
- We have these programming languages that we usually write on a file such as Python, JavaScript or Java, for example.
- And then we somehow have to convert these files to machine code that is ones and zeroes. So that the machine can understand.
- This is where we need a translator!
The Translator
- First, we take the files in which we write the programming language. These files are called source code.
- Then, we provide this source code to a translator that understand the programming language and also understands the machine code. These translators help us convert the source code to machine code for us.
- What is the translator, then?
- It’s not a person.
- It is also a program written by a human! 🤯
- There are two types of translators:
- Interpretor
- Compiler
- Let’s take a few examples to understand this:
Python Programming Language
- The Python Programming usually uses an Interpreter, to translate the source code to machine code.
- Just like a translator from the real world, an Interpreter goes line by line through our code and executes our code on machine.
Java Programming Language
- The Java Programming uses a Compiler, to translate the source code to machine code.
- Compilers are a little bit different.
- A compiler take your code all at once, reads the entire file all at once, and then translates that to machine code.
Summary
- Interpreter translaters line by line and each line executes instructions
- Compilers translates all lines (the entire file), turns it into machine code and executes the whole file at once.
- Now, the differences between Interpreters and Compilers are little complicated and beyond the scope of this blog.
- I just wanted to have you the general picture:
- That when we write code using programming languages like Python JavaScipt, C, C++, or Java; what we are doing is that, we are typing it a language that is human readable.
- Then we are giving this code to translators like Interpreters or Compilers. These spit out machine code that executes instructions on our computers.
The reason I shared the concept of these translators, is because most developers, expecially if they are starting out, don’t even know this process. They just know that they write code and it just runs.
So, if you are planning to learn a programming language like Python, you will clearly understand what’s happening behind the screen.
Best Resources
Here are some of the best resources for you to learn the most easiest programming language: Python
- Python Blog Series : A Blog series where I will be learning and sharing my knowledge on the Python Programming Language.
- Learn Python for Free, Get Hired, and (maybe) Change the World! : A detailed roadmap blog by Jayson Lennon (a Senior Software Engineer) with links to free resources.
- Zero To Mastery Course – Complete Python Developer : A comprehensive course on Python Programming and it’s various applications like Automation, Machine Learning, Web Development and more, taught by Andrei Neagoie (a Senior Developer).
Who Am I?
I’m Aswin Barath, a Software Engineering Nerd who loves building Web Applications, now sharing my knowledge through Blogging during the busy time of my freelancing work life. Here’s the link to all of my socials categorized by platforms under one place: https://linktr.ee/AswinBarath
Thank you so much for reading my blog🙂.
If someone like me asked you this question now: What is a Programming Language?
Can you answer it? Let me know your answer for this question in the comment section.