What is Source Code?

Source code is a computer file that contains a set of instructions that tells the computer what to do.

Source code is written in one of many “computer languages”. A computer language is an artificial language that allows people to write instructions in a way that they can understand, yet still easily convert the instructions to “machine code” that the computer can understand. A special kind of program that converts source code to machine code is called a “compiler”. Some languages convert source code to an intermediate form and execute it a little bit at a time, instead of converting the entire source code file in advance. A special kind of program that does this instead is called an “interpreter”.

Types of Computer Languages

There are many, many computer languages and new ones are being invented all the time. Some well-known languages that you might have heard of before are C++, BASIC, Java, PHP or VB.NET. Different languages have different strengths and weaknesses, which makes them good for different purposes. For example, MATLAB script is often used for writing scientific programs, because the language was specifically designed for math operations.

Some computer languages, such as Assembly code, are considered “low level languages”. This means that the language describes things explicitly in terms of what the hardware must do. For example, there may be specific commands to move data in memory to a particular location, or to read the exact value of a hardware timer.

On the other hand, “high level languages” such as Ada or Ruby work differently. A high level language tends to describe things in terms of ideas and concepts, instead of describing what the hardware does underneath. This makes it easier for people to read and to think about, but it means the programmer may have less control over what the computer actually does.

How “low” or “high” level a language is has nothing to do with the quality or usefulness of the language. Rather, it simply denotes how much the language describes things in terms of hardware functions versus human ideas. High and low level are relative terms. For example, C would be considered high level when compared to Assembly, but low level when compared to VB.NET.

“Hello World” in Asm, a Low-Level Language:

mov ax,cs
mov ds,ax
mov ah,9
mov dx, offset Hello
int 21h
xor ax,ax
int 21h
Hello:
db "Hello World",13,10,"$"

“Hello World” in Rexx, a High-Level Language:

Say "Hello World"

In general, but not always, high-level languages make it easier to write programs that are simple to read and understand. This makes it easier to make changes to down the road, and helps programmers make fewer mistakes. It also makes it easier to express complex ideas.

In general, but not always, low-level languages make it easier to write programs that are smaller or faster. This is because they let the programmer have more control over exactly what the hardware is doing. Low level languages are still used when processor speed or memory is limited, such as in embedded devices like cell phones or microwave ovens, or sometimes in video games. As computers and other electronic devices become faster and have more memory, fewer and fewer programs are written in low-level languages. While it seems probable that ever fewer low-level programs will be written in the future, it seems unlikely that low level languages will ever disappear entirely.

Share and Enjoy

Tags: , , ,

Leave a Reply