Remember, computers are like dogs. They listen to what you tell them. How do you communicate with them? Through a programming language.
What is a programming language?
There are lots of programming languages out there. But there is actually just one computer language. Let me explain, computers run on a CPU. And CPU’s only understand machine code. Machine code is very difficult to write and would take hours.
Luckily, there have been programming languages developed to make it easier to give directions to the CPU. Essentially, programming languages bridge the gap between humans computer hardware.
So, different languages work closer to the CPU than others. The difference is called “low level” versus “high level” where low level runs closer to the CPU and thus is more difficult to understand. The closest programming language to the CPU is Assembly. Higher level languages would be something like Python or Ruby.
Don’t get too caught up in this stuff. Just realize that whenever we code, it’s converted to machine code so the computer can understand it.
What we care about is source code. That’s what us humans actually write.
Source Code Is Just Text.
There is nothing magical about source code—it’s just plain text. Text you type into a text editor.
As I have mentioned before, many programming languages share a common history and are more alike than different. For instance, the statement below of one of the most simple programs is the same across three languages: ALGOL 68, Python 3 and Lua.
Don’t worry about the programming languages mentioned above right now. The important takeaway is that there are similarities across languages.
Unlike the statement above which is simple and clean, some languages require certain characters to show the start and finish of a statement. Kind of like a period at the end of a sentence, except in this case it’s often a semicolon or bracket.
We write code (or programs) in a text editor, which is different than a word processor. (I’ll get into this in a future post.)
Source Code Gets Converted Before It Can Run.
There are two main ways to convert: compiled vs interpreted. Luckily, it’s not a decision we have to worry about. But it is worth knowing difference; however, don’t get too bogged down in the details.
Compiled languages is when a person writes the code, compiler separates the file and the end result is an executable file. Basically, owner keeps the source code.
Here’s a quick table to show the pros and cons of each.
There is also an intermediate approach combines the two. It takes the source code as far to machine code as it can get, compiles it partly. It is still portable then across platforms.
Examples of the languages:
- Compiled: C, C++, Objective C
- Hyprid: Java, C#, VB.NET, Python
So, which do you use? That depends on your goals. Are you looking to build a website? Make a mobile app? Or build a computer program that needs to be highly secure?
We’ll get to language differences and implications next.Images: Sebastiaan ter Burg/Flickr; Programming for kids/Wikijunior