Internet
Fact-checked

At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Are the Different Types of Source Code?

Gregory Hanson
Gregory Hanson

Every programming and markup language has its own particular form of source code, sometimes referred to simply as "source." This code consists of a description of tasks that a computer is to perform and is written and stored in a text format that a human can easily read. Some code is compiled before use, a process that transforms the source into a set of instructions in machine language. Text in a markup language such as HTML is not technically source code in the pure sense of the term but is often referred to as such. There are also different legal categories of source code with the most important division being between open and closed-source.

Each programming language uses a different syntax to represent an underlying algorithm. These differences mean that source code varies from language to language. Some languages, such as C and C++, are related and share certain elements of style and syntax.

Source code could be written in C++, a commonly used computer programming language.
Source code could be written in C++, a commonly used computer programming language.

Some conventions of programming style occur across most languages. For instance, nearly every language includes some system to denote comments, or parts of the code that are intended for human viewers rather than for processing by a compiler. This is such a common feature of source code that several styles of comment notation appear in more than one programming language.

All true source code must be run through a compiler and turned into machine language before it can be executed by a computer.
All true source code must be run through a compiler and turned into machine language before it can be executed by a computer.

All true source code must be run through a compiler and turned into machine language before it can be executed by a computer. In some cases, such as Python in interactive mode, this task is performed dynamically. In other cases, the compiler produces an executable file which stores the instructions in machine language for later use.

The marked-up text that makes up a large portion of the content of the Web is not technically source code. A certain similarity exists, however, as HTML and other related markup languages convey meaning and describe tasks to be performed by a computer, specifically the ways in which text and other information are to be formatted and displayed. Thus, text that has been marked up in HTML is often referred to as source code.

Legally speaking, there are two models for source ownership and distribution. Open source software is software whose code is provided, sometimes with no strings attached and sometimes under an open source license agreement that preserves some basic rights for the author. Some such agreements limit the sorts of modifications that can be performed to the source code, but some simply stipulate that credit must be given to the original author.

Closed source is the other major legal variety of source code. In this model, only an executable file is provided to a license-holder. Users are banned from attempting to decompile the executable files to reveal the underlying code. This legal model dominates the commercial software field, although some open source business models have proven to be viable as well.

Discuss this Article

Post your comments
Login:
Forgot password?
Register:
    • Source code could be written in C++, a commonly used computer programming language.
      By: ビッグアップジャパン
      Source code could be written in C++, a commonly used computer programming language.
    • All true source code must be run through a compiler and turned into machine language before it can be executed by a computer.
      By: Photo_Ma
      All true source code must be run through a compiler and turned into machine language before it can be executed by a computer.