New Year's Sale:

Up to 69 % OFF

03

:

12

:

49

:

29

Zyro encyclopedia

Learn about online business

Zyro Glossary Website builder

Source Code

code-on-laptop-screen-white-background

What is source code?

Source code is code written by programmers in a programming language that can be understood and interpreted by other humans as well as computers.

Source code can be customized by anyone who has access and the coding skill required.

Every website page, whether coded in a programming language from scratch or created with a website builder has its own source code.

Some of the most popular programming languages used by programmers to write source code include: 

  • C++
  • C#
  • Java
  • Javascript
  • Pascal
  • Python
  • PHP

A developer may use different programming languages to write source code, depending on the context of the project.

Example of source code

Here is an example of source code using the C# programming language:

using System;

namespace HelloWorld

{

class Program

{

static void Main (string[] args)

{

Console.WriteLine(“Hello World!”);

}

}

}

Some computer programs contain much more complex lines than the example above. The more complex the intention of the code becomes, the longer the text is. 

To see a website’s HTML or XML source code, you can use your web browser’s View Page Source and Inspect Elements feature.

How source code transforms into usable software, apps, and websites

Source code is written using a text editor (like the Notepad on Windows) or an Integrated Development Environment (IDE). 

An IDE is usually used to create bigger projects since it combines all the tools needed for efficient development — a text editor, interpreter or compiler, debugger, and so on.

For a computer to understand and execute the program, source code must be translated into machine code.

There are two ways to translate source code into machine language – with the use of either a compiler or an interpreter application. 

The methods depend on the programming language used to write the source code. For example, if the code is written in the C language or its variants, then it needs to be translated using a compiler.

A compiler is a type of application that turns source code into an executable file. The output of this program is called object code. 

Object code only contains binary code — a string of the numbers one and zero — that can be understood and executed by the computer.

After the source code is compiled and turned into an executable, it isn’t necessary to run the program. That’s why source code and object code are usually called the “before” and “after” versions of the software. 

Another method to run source code is by using an interpreter. 

An interpreter can translate and execute the source code directly without transforming it into a machine language. Examples of interpreted languages are Javascript, Matlab, and Python.

The translation process of the interpreter method is faster than a compiler, but its execution is slower. 

The term object code doesn’t apply for an interpreter system since there is only one form of the code used to run the program, which is the source code itself.

Developers can choose to make their source code proprietary or open.

Proprietary source code is protected by copyright, meaning it can’t be customized and distributed without the permission of its owner.

An example of proprietary software is Microsoft Office. Its users can only use the already compiled program and have no access to its code.

Many software companies choose to protect their source code to prevent the customer from changing it, which may risk breaking the program.

An open-source file, however, is shared for free and can be downloaded and modified by anyone.

Apache OpenOffice is an example of open-source software. Unlike Microsoft Office, its users have access to the program’s source code.

You can find open source files on sites like GitHub, GitKraken, and SourceForge. Developers can use these platforms to share their code for learning purposes or recycle old code to create new programs.

Many open-source code files require developers to comply with specific conditions before using it. For instance, they should name the author or include a copy of the program’s license.

Written by

Author avatar

Olivia

Olivia is a writer for Zyro and an eCommerce know-it-all. Having spent many years as a retail buyer, she loves writing about trend forecasting, brand building, and teaching others how to optimize online stores for success. She lives in London and spends a lot of time exploring the city’s parks with her whippet.

Got a business idea? Build it with Zyro.

Get started