Home Software Development Guide Programming Concepts Source Code

Source Code

by wforbes

(Part 4 of my Programming Concepts series)

On the inside, a computer program is basically just a huge list of instructions. Every single computer program, application, app, software, and even video game you’ve ever used is made entirely of these instructions. When your computer runs a computer program, it simply carries out these instructions, one instruction at a time. That’s all that a computer program is, a bunch of commands that you want the computer to do. These commands are typed by a programmer into a set of special text files with special text in them, this is the code.

Source code is the term we use to describe that special text and source files are the special text files with the code in them. When you write source code, you’re just writing instructions that you’d like the computer to carry out. The computer reads the source file in a similar way to how we read them. They start at the beginning and read one character (i.e. letter, number, or symbol) at a time from left to right, and one line at a time from top to bottom.

When you’ve finished writing source code and you’d like the computer to turn it into a computer program, you use a compiler. A compiler is a special program that turns your source code, which is easily read by humans, into machine code or binary code that the computer can read. At the ‘lowest level’, computers can really only understand binary code (zeroes and ones). That’s because the computer’s processor chip is made of a bunch of switches that turn on and off extremely quickly as power flows through it. Zero for ‘off’, One for ‘on’. Binary code, or machine code, is really difficult for humans to read. So we invented the ‘higher level’ programming languages that source code is written in. We write out what we want the computer program to do with our source code in a programming language, then we compile it to convert it to machine code, then we can run it as a computer program!

When source code files are compiled (or converted) into machine code files, those files must also be linked together to produce the finished product of a computer program. The process of compiling and linking is called building, or creating a build. This term is often used to describe a specific version of a computer program that is ready to be used, and given a version number. For instance, Microsoft Windows 10 updates are given a build number… I’m currently using “Windows 10 build 18363”!

In many respects, source code files are very similar to any text documents that you’ve created before, there are just two major differences. First, as we already mentioned once, the source code files need to be written using one of the many programming languages we have available to us that use a specific syntax to communicate our instructions to the computer clearly. Second, the source code files have special file extensions – we’ll go over those next!

Continue to Part 5 “Code Basics: File Extensions and File Types” >