User:Buidhe paid/Source code
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
Notable runtimes |
|
Notable compilers & toolchains |
|
In computing, source code, or simply code or source, is text (usually plain text) that conforms to a human-readable programming language and specifies the behavior of a computer. A programmer writes code to produce a program that runs on a computer.
Since a computer, at base, only understands machine code, source must be translated in order to be used by the computer and this can be implemented in a variety of ways depending on available technology. Source code can be converted by a compiler or an assembler into machine code that can be directly executed. Alternatively, source code can be processed without conversion to machine code via an interpreter that performs the actions prescribed by the source code via the interpreter's machine code. Other technology (i.e. bytecode) incorporates both mechanisms by converting the source code to an intermediate form that is often not human-readable but also not machine code and an interpreter executes the intermediate form.
Most languages allow for comments. The programmer can add comments to document the source code for themself and for other programmers reading the code. Comments cannot be represented in machine code, and therefore, are ignored by compilers, interpreters and the like.
Often, the source code of application software is not distributed or publicly available since the producer wants to protect their Intellectual property (IP). But, if the source code is available (open source), it can be useful to a user, programmer or a system administrator, any of whom might wish to study or modify the program.
Background
The first programmable computers, which appeared at the end of the 1940s,[2] were programmed in machine language (simple instructions that could be directly executed by the processor). Machine language was difficult to debug and was not portable between different computer systems.[3] Initially, hardware resources were scarce and expensive, while human resources were cheaper.[4] As programs grew more complex, programmer productivity became a bottleneck. This led to the introduction of high-level programming languages in the mid-1950s. These languages abstracted away the details of the hardware, instead being designed to express algorithms that could be understood more easily by humans.[5][6] 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.[6] 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.[7]
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. 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.[8]
Organization
Most programs do not contain all the resources needed to run them and rely on external libraries. Part of the compiler's function is to link these files in such a way that the program can be executed by the hardware.[9]
Software developers often use configuration management to track changes to source code files. The configuration management system also keeps track of which object code file corresponds to which version of the source code file.[10]
Purposes
Estimation
The number of lines of source code is often used as a metric when evaluating the productivity of computer programmers, the economic value of a code base, effort estimation for projects in development, and the ongoing cost of software maintenance after release.[11]
Communication
Source code is also used to communicate algorithms between people – e.g., code snippets online or in books.[12]
Computer programmers may find it helpful to review existing source code to learn about programming techniques.[12] The sharing of source code between developers is frequently cited as a contributing factor to the maturation of their programming skills.[12] Some people consider source code an expressive artistic medium.[13]
Modification
Compilation and execution
Source code files in a high-level programming language must go through a stage of preprocessing into machine code before the instructions can be carried out.[7] After being compiled, the program can be saved as an object file and the loader (part of the operating system) can take this saved file and execute it as a process on the computer hardware.[9] Some programming languages use an interpreter instead of a compiler. An interpreter converts the program into machine code at run time, which makes them 10 to 100 times slower than compiled programming languages.[14][15]
Quality and security
Software quality is defined as meeting the stated requirements as well as customer expectations.[16] Quality is an overarching term that can refer to a code's correct and efficient behavior, its reusability and portability, or the ease of modification.[17] It is usually more cost-effective to build quality into the product from the beginning rather than try to add it later in the development process.[18] Higher quality code will reduce lifetime cost to both suppliers and customers as it is more reliable and easier to maintain.[19][20] Software failures in safety-critical systems can be very serious including death.[19] By some estimates, the cost of poor quality software can be as high as 20 to 40 percent of sales.[21] Despite developers' goal of delivering a product that works entirely as intended, virtually all software contains bugs.[22]
The rise of the Internet also greatly increased the need for computer security as it enabled malicious actors to conduct cyberattacks remotely.[23][24] If a bug creates a security risk, it is called a vulnerability.[25][26] Software patches are often released to fix identified vulnerabilities, but those that remain unknown (zero days) as well as those that have not been patched are still liable for exploitation.[27] Vulnerabilities vary in their ability to be exploited by malicious actors,[25] and the actual risk is dependent on the nature of the vulnerability as well as the value of the surrounding system.[28] Although some vulnerabilities can only be used for denial of service attacks that compromise a system's availability, others allow the attacker to inject and run their own code (called malware), without the user being aware of it.[25] To thwart cyberattacks, all software in the system must be designed to withstand and recover from external attack.[24] Despite efforts to ensure security, a significant fraction of computers are infected with malware.[29]
Copyright and licensing
The situation varies worldwide, but in the United States before 1974, software and its source code was not copyrightable and therefore always public domain software.[30]
In 1974, the US Commission on New Technological Uses of Copyrighted Works (CONTU) decided that "computer programs, to the extent that they embody an author's original creation, are proper subject matter of copyright".[31][32]
Proprietary software is rarely distributed as source code.[33] Although the term open-source software literally refers to public access to the source code,[34] 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.[35][36]
See also
- Bytecode
- Code as data
- Coding conventions
- Computer code
- Free software
- Legacy code
- Machine code
- Markup language
- Obfuscated code
- Object code
- Open-source software
- Package (package management system)
- Programming language
- Source code repository
- Syntax highlighting
- Visual programming language
References
- ^ Kernighan, Brian W. "Programming in C: A Tutorial" (PDF). Bell Laboratories, Murray Hill, N. J. Archived from the original (PDF) on 23 February 2015.
- ^ Gabbrielli & Martini 2023, p. 519.
- ^ Gabbrielli & Martini 2023, pp. 520–521.
- ^ Gabbrielli & Martini 2023, p. 522.
- ^ Gabbrielli & Martini 2023, p. 521.
- ^ a b Tracy 2021, p. 1.
- ^ a b Tracy 2021, p. 121.
- ^ Lin et al. 2001, pp. 238–239.
- ^ a b Tracy 2021, pp. 122–123.
- ^ O'Regan 2022, pp. 230–231, 233.
- ^ Foster 2014, pp. 249, 274, 280, 305.
- ^ a b c Spinellis, D: Code Reading: The Open Source Perspective. Addison-Wesley Professional, 2003. ISBN 0-201-79940-5
- ^ "Art and Computer Programming" ONLamp.com Archived 20 February 2018 at the Wayback Machine, (2005)
- ^ O'Regan 2022, p. 375.
- ^ Sebesta 2012, p. 28.
- ^ Galin 2018, p. 3.
- ^ Galin 2018, p. 26.
- ^ O'Regan 2022, pp. 68, 117.
- ^ a b O'Regan 2022, pp. 3, 268.
- ^ Varga 2018, p. 12.
- ^ O'Regan 2022, p. 119.
- ^ Ablon & Bogart 2017, p. 1.
- ^ Campbell-Kelly & Garcia-Swartz 2015, p. 164.
- ^ a b O'Regan 2022, p. 266.
- ^ a b c Ablon & Bogart 2017, p. 2.
- ^ Daswani & Elbayadi 2021, p. 25.
- ^ Daswani & Elbayadi 2021, pp. 26–27.
- ^ Haber & Hibbert 2018, pp. 5–6.
- ^ Kitchin & Dodge 2011, p. 37.
- ^ Liu, Joseph P.; Dogan, Stacey L. (2005). "Copyright Law and Subject Matter Specificity: The Case of Computer Software". New York University Annual Survey of American Law. 61 (2). Archived from the original on 25 June 2021.
- ^ Apple Computer, Inc. v. Franklin Computer Corporation Puts the Byte Back into Copyright Protection for Computer Programs Archived 7 May 2017 at the Wayback Machine in Golden Gate University Law Review Volume 14, Issue 2, Article 3 by Jan L. Nussbaum (January 1984)
- ^ Lemley, Menell, Merges and Samuelson. Software and Internet Law, p. 34.
- ^ Boyle 2003, p. 45.
- ^ Morin et al. 2012, Open Source versus Closed Source.
- ^ Sen et al. 2008, p. 209.
- ^ Morin et al. 2012, Free and Open Source Software (FOSS) Licensing.
Sources
- Ablon, Lillian; Bogart, Andy (2017). Zero Days, Thousands of Nights: The Life and Times of Zero-Day Vulnerabilities and Their Exploits (PDF). Rand Corporation. ISBN 978-0-8330-9761-3.
- Campbell-Kelly, Martin; Garcia-Swartz, Daniel D. (2015). From Mainframes to Smartphones: A History of the International Computer Industry. Harvard University Press. ISBN 978-0-674-28655-9.
- Daswani, Neil; Elbayadi, Moudy (2021). Big Breaches: Cybersecurity Lessons for Everyone. Apress. ISBN 978-1-4842-6654-0.
- Foster, Elvis C. (2014). Software Engineering: A Methodical Approach. Apress. ISBN 978-1-4842-0847-2.
- Galin, Daniel (2018). Software Quality: Concepts and Practice. John Wiley & Sons. ISBN 978-1-119-13449-7.
- Haber, Morey J.; Hibbert, Brad (2018). Asset Attack Vectors: Building Effective Vulnerability Management Strategies to Protect Organizations. Apress. ISBN 978-1-4842-3627-7.
- Kitchin, Rob; Dodge, Martin (2011). Code/space: Software and Everyday Life. MIT Press. ISBN 978-0-262-04248-2.
- Lin, Daniel; Sag, Matthew; Laurie, Ronald S. (2001). "Source Code versus Object Code: Patent Implications for the Open Source Community". Santa Clara Computer and High Technology Law Journal. 18: 235.
- Morin, Andrew; Urban, Jennifer; Sliz, Piotr (2012). "A Quick Guide to Software Licensing for the Scientist-Programmer". PLOS Computational Biology. 8 (7): e1002598. doi:10.1371/journal.pcbi.1002598. ISSN 1553-7358.
{{cite journal}}
: CS1 maint: unflagged free DOI (link) - O'Regan, Gerard (2022). Concise Guide to Software Engineering: From Fundamentals to Application Methods. Springer Nature. ISBN 978-3-031-07816-3.
- Sen, Ravi; Subramaniam, Chandrasekar; Nelson, Matthew L. (2008). "Determinants of the Choice of Open Source Software License". Journal of Management Information Systems. 25 (3). Informa UK Limited: 207–240. doi:10.2753/mis0742-1222250306. ISSN 0742-1222.
- Sebesta, Robert W. (2012). Concepts of Programming Languages (10 ed.). Addison-Wesley. ISBN 978-0-13-139531-2.
- Tracy, Kim W. (2021). Software: A Technical History. Morgan & Claypool Publishers. ISBN 978-1-4503-8724-8.
- Varga, Ervin (2018). Unraveling Software Maintenance and Evolution: Thinking Outside the Box. Springer. ISBN 978-3-319-71303-8.
External links
- ^ Katyal, Sonia K. (2018–2019). "The Paradox of Source Code Secrecy". Cornell Law Review. 104: 1183.
{{cite journal}}
: CS1 maint: date format (link) - ^ Knaster, Scott; Malik, Waqar; Dalrymple, Mark (2012). "Source File Organization". Learn Objective-C on the Mac: For iOS and OS X. Apress. pp. 79–90. ISBN 978-1-4302-4189-8.