Definition: Source code is the human-readable expression of a program, component or system in a programming language. It contains instructions and structures that describe behaviour before they are translated, interpreted or otherwise processed for execution.
It may be distributed across one or more files and include comments, modules, declarations and references to dependencies. Supporting files containing configuration, tests and build rules often accompany it, although these materials perform different roles within a project.
Table of contents
How source code relates to software
Source code is part of software, but the terms are not synonymous. A product may include code, executable files, libraries, graphical resources, data, documentation and other components needed for operation or distribution.
The same codebase can produce different results depending on the platform, build options or dependencies. Likewise, having an executable program does not imply access to the original instructions from which it was produced.
Machine code consists of instructions that a processor can execute. Source code, by contrast, is written so that people can read, review and modify it with development tools.
How source code becomes executable
The execution model depends on the language and its environment. Source code is not always compiled in advance or converted directly into a binary file. Common models include:
- Compilation: a compiler transforms the code into machine code or another representation before execution.
- Interpretation: an interpreter analyses and executes instructions while the program is running.
- Intermediate code: some languages produce bytecode or another representation that runs on a virtual machine.
- JIT compilation: certain environments translate parts of a program during execution.
- Transpilation: a tool converts one language or version into equivalent source code in another.
A project may also go through assembly, linking, optimisation, packaging and testing. Together, these tasks form the build process and may produce applications, libraries, services or files intended for another environment.
Licensing and access
The technical ability to read code does not by itself determine what someone may do with it. Applicable rights to use, modify and distribute it depend on the licence and the law. Common situations include:
- Open source: open-source licences grant rights to use, study, modify and redistribute code under specific conditions. GPL, MIT and Apache are examples with different obligations.
- Proprietary software: the rights holder retains exclusive rights and may withhold the source or permit inspection only under limited conditions.
- Source available: a project can publish its code without granting all the permissions required by an open-source licence.
- Public domain: this is not a licence. It may result from copyright expiry or from waiver and dedication mechanisms where the relevant legal system permits them.
- Dual licensing: the same code may be offered under two licences, while an open-core model keeps some components open and others proprietary.
Price does not define the licence either. Free or freemium software can be proprietary, while an open-source project may offer paid services. A useful description separates access and rights from cost.
Source code in web development
On the web, browsers receive resources such as HTML, CSS and JavaScript. These files form part of the client-side code and can be inspected with browser tools, even when they have been minified or bundled.
Server-side code is not normally delivered to visitors. A site can generate HTML with PHP, Python, Java or other technologies without exposing those instructions. Viewing a page’s delivered code therefore does not reveal its complete logic, database or internal services.
The frontend may also be organised with components, preprocessors and bundling tools. The browser receives a production output that may not correspond line by line with the files maintained by developers.
Uses in development and maintenance
Source code is the material that teams work on throughout the software lifecycle. Its availability supports several tasks:
- Review: teams can analyse changes, identify defects and check whether an implementation meets its requirements.
- Maintenance: developers can fix errors, update dependencies and adapt a program to new environments.
- Version control: platforms such as GitHub record changes, branches and contributions within code repositories.
- Auditing: the code provides material for examining quality, privacy or security, although access alone does not guarantee that a program has no vulnerabilities.
- Learning: developers can study programming techniques and decisions when the licence permits them to inspect and reuse the material.
Preserving the code, its dependencies and its build instructions supports technical continuity. Without these elements, reproducing a release, fixing a fault or moving a system can be difficult even when a working executable still exists.
