Lably
Skip to content

Source code

Human-readable instructions for a computer

  • 9 min read
  • 6 chapters

Related on Lably

Through Computing, Computer and Computer program

Source code is typically stored in source files. Beyond software, the term source file is used across other domains — such as documents, images, hardware design, and typography — to refer to the original, editable file from which a distribution format is derived.

Background

The first programmable computers, which appeared at the end of the 1940s, were programmed in machine code (simple instructions that could be directly executed by the processor). Machine language was difficult to debug and was not portable between different computer systems. Initially, hardware resources were scarce and expensive, while human resources were cheaper. As programs grew more complex, programmer productivity became a bottleneck. This led to the introduction of high-level programming languages such as Fortran in the mid-1950s. These languages abstracted away the details of the hardware, and were designed to express algorithms that could be understood more easily by humans. As instructions distinct from the underlying computer hardware, software is therefore relatively recent, dating to these early high-level programming languages such as Fortran, Lisp, and Cobol. The invention of high-level programming languages was simultaneous with the compilers needed to translate the source code automatically into machine code that can be directly executed on the computer hardware.

Some definitions of source code consider it to be the form of code that is modified directly by humans, typically in a high-level programming language.

Object code can be directly executed by the machine and is generated automatically from the source code, often via an intermediate step, assembly language. While object code will only work on a specific platform, source code can be ported to a different machine and recompiled there. For the same source code, object code can vary significantly—not only based on the machine for which it is compiled, but also based on performance optimization from the compiler.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication