source code

Contributor(s): Matt Haughn, Scott Wallask

Source code is the fundamental component of a computer program that is created by a programmer. It can be read and easily understood by a human being. When a programmer types a sequence of C programming language statements into Windows Notepad, for example, and saves the sequence as a text file, the text file is said to contain the source code. 

Source code and object code are sometimes referred to as the "before" and "after" versions of a compiled computer program. For script (noncompiled or interpreted) program languages, such as JavaScript, the terms source code and object code do not apply, since there is only one form of the code.

Programmers can use a text editor, a visual programming tool or an integrated development environment (IDE) such as software development kit (SDK) to create source code. In large program development environments, there are often management systems that help programmers separate and keep track of different states and levels of source code files. 

Licensing of source code

Source code can be proprietary or open, and licensing agreements often reflect this distinction.

When a user installs a software suite like Microsoft Office, for example, the source code is proprietary, and Microsoft only gives the customer access to the software's compiled executables and the associated library files that various executable files require to call program functions.

By comparison, when a user installs Apache OpenOffice, its open source software code can be downloaded and modified.

Typically, proprietary software vendors like Microsoft don't share source code with customers for two reasons: to protect intellectual property and to prevent the customer from making changes to source code in a way that might break the program or make it more vulnerable to attack. Proprietary software licenses often prohibit any attempt to discover or modify the source code.

Open source software (OSS), on the other hand, is purposely designed with the idea that source code should be made available because the collaborative effort of many developers working to enhance the software can, presumably, help make it more robust and secure. Users can freely take open source code under public licenses, such as the GNU General Public License.

Purposes of source code

Beyond providing the foundation for software creation, source code has other important purposes, as well. For example, skilled users who have access to source code can more easily customize software installations, if needed.

Meanwhile, other developers can use source code to create similar programs for other operating platforms -- a task that would be trickier without the coding instructions.

Access to source code also allows programmers to contribute to their community, either through sharing code for learning purposes or by recycling portions of it for other applications.

Organization of source code

Many different programs exist to create source code. Here is an example of the source code for a Hello World program in C language:

/* Hello World program */


printf("Hello World");


Even a person with no background in programming can read the C programming source code above and understand that the goal of the program is to print the words "Hello World." In order to carry out the instructions, however, this source code must first be translated into a machine language that the computer's processor can understand; that is the job of a special interpreter program called a compiler -- in this case, a C compiler.

After programmers compile source code, the file that contains the resulting output is referred to as object code.

Object code consists mainly of the numbers one and zero and cannot be easily read or understood by humans. Object code can then be "linked" to create an executable file that runs to perform the specific program functions.

Source code management systems can help programmers better collaborate on source code development; for example, preventing one coder from inadvertently overwriting the work of another.

History of source code

Determining the historical start of source code is a subjective -- and elusive -- exercise. The first software was written in binary code in the 1940s, so depending on one's viewpoint, such programs may be the initial samples of source code.

One of the earliest examples of source code as we recognize it today was written by Tom Kilburn, an early pioneer in computer science. Kilburn created the first successful digital program held electronically in a computer's memory in 1948 (the software solved a mathematical equation).

Tom Kilburn's highest factor routine
Tom Kilburn's highest factor routine

In the 1950s and '60s, source code was often provided for free with software by the companies that created the programs. As growing computer companies expanded software's use, source code became more prolific and sought after. Computing magazines prior to the internet age would often print source code in their pages, with readers needing to retype the code character for character for their own use. Later, floppy disks decreased the price for electronically sharing source code, and then the internet further deleted these obstacles.

This was last updated in September 2019

Continue Reading About source code

Dig Deeper on Managing software development teams

Join the conversation


Send me notifications when other members comment.

Please create a username to comment.

What tools do you prefer to use when creating source code?
I mostly prefer Notepad++
I am C Programmer. I used to write source code in Editor like VIM. The written code is basically compiled through GCC compiler. The compiler makes my source code to object code/executable file.

While preparing code for RTOS (FreeRTOS) I would prefer LPC Expresso IDE, to make my source code. And typical Embedded coding using Keil IDE.
I am a freelance Web Programmer and I normally write my source code in Notepad++.
I'm not a programmer and haven't written anything since my Fortran homework in college a long time ago. I have an old DOS program that sends print jobs to LPT1 and I'd like to find out if the job could be sent to my USB port. I've tried DOSbox and Printfil with no luck. The software downloads special fonts to the printer, so that's part of the problem. I need those fonts. Where could I find someone to tweak the software? Thank you for any suggestions!
Hi Margaret how are you? Do you go to GitHub to blog by any chanc? you kinda look familure. This is extreemly hard subject to get refrinces on the charicters and short abrieviations. I did abit of http many years ago and trying to get some sorece refrinces. you know the little stuff thats essy to fore getthe {} is the only one I can remember off the top of my head but some of the actions are comeing back. Im useing the Atom at github and the visual studio at msn. Boath verry nice to work with now if I couldjustget me working  have fun and dont tell any one. sssshhh       C U      Roodalf 
where can i get some standard terms & conditions while transferring source code to another party.


Great looking web site. This has been quite helpful. Thank you so very much for this valuable information continue your web page and good luck, we at Addhunters shifted this service to a level much higher than the broker concept. So, if you’re willing to buy a property in Qatar in terms of investment or moving to a new home, here are some perfect options for you. You can see more details please visit our web site. <a href="">Property for sale Property in pearl qatar </a>