In computing, source code, or simply code or source, is human readable plain text that can eventually result in controlling the behavior of a computer. In order to control a computer, it must be processed by a computer program either executed directly via an interpreter or translated into a more computer-consumable form such as via a compiler. Sometimes, code is compiled directly to machine code so that it can be run in the native language of the computer without further processing. Many modern environments, though, involve compiling to an intermediate representation such as bytecode that can either run via an interpreter or be compiled on-demand to machine code via just-in-time compilation.
Source code is 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.
Software developers often use configuration management to track changes to source code files (version control). The configuration management system also keeps track of which object code file corresponds to which version of the source code file.
Computer can find it helpful to review extant source code to learn about programming techniques. The sharing of source code between developers is often cited as a contributing factor to the maturing of their programming skills. Some consider source code an expressive artistic medium." Art and Computer Programming" ONLamp.com , (2005)
Source code often contains comments—blocks of text marked for the compiler to ignore. This content is not part of the program logic, but is instead intended to help readers understand the program.
Companies often keep the source code confidential in order to hide algorithms considered a trade secret. Proprietary, secret source code and algorithms are widely used for sensitive government applications such as criminal justice, which results in black box behavior with a lack of transparency into the algorithm's methodology. The result is avoidance of public scrutiny of issues such as bias.
Many software programmers use an integrated development environment (IDE) to improve their productivity. IDEs typically have several features built in, including a source-code editor that can alert the programmer to common errors. Modification often includes code refactoring (improving structure without changing function) and restructuring (improving structure and function simultaneously). Nearly every change to code introduces new bugs or unexpected , which require another round of fixes.
by other developers are often used to scrutinize new code added to a project. The purpose of this phase is often to verify that the code meets style and maintainability standards and that it is a correct implementation of the software design. According to some estimates, code review dramatically reduce the number of bugs persisting after software testing is complete. Along with software testing that works by executing the code, static program analysis uses automated tools to detect problems with the source code. Many IDEs support code analysis tools, which might provide metrics on the clarity and maintainability of the code. Debuggers are tools that often enable programmers to step through execution while keeping track of which source code corresponds to each change of state.
For this goal, minified, obfuscated, or decompiled source code files (all of which eliminate the comments in the original code) are generally just as portable as the original source code files (which nearly always include commments), even though they are far less useful for modification, and therefore don't meet the definition of source code in the GNU General Public License, version 2 (GPL2).
Maintainability is the quality of software enabling it to be easily modified without breaking extant functions. Following coding conventions such as using clear function and variable names that correspond to their purpose makes maintenance easier. Use of conditional loop statements only if the code could execute more than once, and eliminating code that will never execute can also increase understandability. Many software development organizations neglect maintainability during the development phase, even though it will increase long-term costs. Technical debt is incurred when programmers, often out of laziness or urgency to meet a deadline, choose quick and dirty solutions rather than build maintainability into their code. A common cause is underestimates in software development effort estimation, leading to insufficient resources allocated to development. A challenge with maintainability is that many software engineering courses do not emphasize it. Development engineers who know that they will not be responsible for maintaining the software do not have an incentive to build in maintainability.
Proprietary software is rarely distributed as source code. Although the term open-source software literally refers to public access to the source code, open-source software has additional requirements: free redistribution, permission to modify the source code and release derivative works under the same license, and nondiscrimination between different uses—including commercial use. The free software reuse of open-source software can speed up development.
Modification
Compilation and execution
Portability
Quality
Copyright and licensing
See also
Sources
External links
|
|