Source Code vs Machine Code, Explained Simply

Vlad Chernis
2 min readMar 4, 2018

--

machine code, actual size

A game (or any other piece of software) is published as a bunch of instructions written for the machine to follow. These instructions are machine code.

Humans can read and write machine code, that’s what they did in the old days when software was much simpler, but it was still very tedious and error prone.

To make things easier for humans to read and write software, we made up a new language. This language is just a bunch of convenient shortcuts for writing down common phrases and connecting them with other phrases that are tedious and error prone to write in machine code.

Now we read and write software in this convenient language.

But there are actually a lot of these convenient languages, and new ones are still being created, so it’s impractical for all machines to understand all these languages, so they just stick to machine code.

This means we need to translate from each convenient language to machine code. That’s why the instructions written in the convenient language are called “source code” — it’s the source of the machine code.

To prevent meaning from getting lost in translation, the translation process is designed to be literal and mechanical, unlike translating English to French.

Remember that unlike the source code, the machine code is tedious and error prone to read and write. The fact that the machine code wasn’t really written thoughtfully but just mechanically translated from the source code makes it event harder to understand (for humans).

So if someone wants to read or change a piece of software for which the source code isn’t published, they have to read or change the machine code, which is impractically difficult.

If the source code of a piece of software is published, it’s suddenly much easier to understand, copy and change the software.

Since source code can take years to write but no time at all to copy, it’s often kept secret.

--

--