User:Buidhe paid/Source code

From Wikipedia, the free encyclopedia
Simple C-language source code example, a procedural programming language. The resulting program prints "hello, world" on the computer screen. This first known "Hello world" snippet from the seminal book The C Programming Language originates from Brian Kernighan in the Bell Laboratories in 1974.[1]

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[edit]

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[edit]

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]

A more complex Java source code example. Written in object-oriented programming style, it demonstrates boilerplate code. With prologue comments indicated in red, inline comments indicated in green, and program statements indicated in blue.

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[edit]

Estimation[edit]

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[edit]

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[edit]

Compilation and execution[edit]

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[edit]

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[edit]

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[edit]

References[edit]

  1. ^ Kernighan, Brian W. "Programming in C: A Tutorial" (PDF). Bell Laboratories, Murray Hill, N. J. Archived from the original (PDF) on 23 February 2015.
  2. ^ Gabbrielli & Martini 2023, p. 519.
  3. ^ Gabbrielli & Martini 2023, pp. 520–521.
  4. ^ Gabbrielli & Martini 2023, p. 522.
  5. ^ Gabbrielli & Martini 2023, p. 521.
  6. ^ a b Tracy 2021, p. 1.
  7. ^ a b Tracy 2021, p. 121.
  8. ^ Lin et al. 2001, pp. 238–239.
  9. ^ a b Tracy 2021, pp. 122–123.
  10. ^ O'Regan 2022, pp. 230–231, 233.
  11. ^ Foster 2014, pp. 249, 274, 280, 305.
  12. ^ a b c Spinellis, D: Code Reading: The Open Source Perspective. Addison-Wesley Professional, 2003. ISBN 0-201-79940-5
  13. ^ "Art and Computer Programming" ONLamp.com Archived 20 February 2018 at the Wayback Machine, (2005)
  14. ^ O'Regan 2022, p. 375.
  15. ^ Sebesta 2012, p. 28.
  16. ^ Galin 2018, p. 3.
  17. ^ Galin 2018, p. 26.
  18. ^ O'Regan 2022, pp. 68, 117.
  19. ^ a b O'Regan 2022, pp. 3, 268.
  20. ^ Varga 2018, p. 12.
  21. ^ O'Regan 2022, p. 119.
  22. ^ Ablon & Bogart 2017, p. 1.
  23. ^ Campbell-Kelly & Garcia-Swartz 2015, p. 164.
  24. ^ a b O'Regan 2022, p. 266.
  25. ^ a b c Ablon & Bogart 2017, p. 2.
  26. ^ Daswani & Elbayadi 2021, p. 25.
  27. ^ Daswani & Elbayadi 2021, pp. 26–27.
  28. ^ Haber & Hibbert 2018, pp. 5–6.
  29. ^ Kitchin & Dodge 2011, p. 37.
  30. ^ 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.
  31. ^ 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)
  32. ^ Lemley, Menell, Merges and Samuelson. Software and Internet Law, p. 34.
  33. ^ Boyle 2003, p. 45.
  34. ^ Morin et al. 2012, Open Source versus Closed Source.
  35. ^ Sen et al. 2008, p. 209.
  36. ^ Morin et al. 2012, Free and Open Source Software (FOSS) Licensing.

Sources[edit]

[1][2]

External links[edit]



  1. ^ Katyal, Sonia K. (2018–2019). "The Paradox of Source Code Secrecy". Cornell Law Review. 104: 1183.{{cite journal}}: CS1 maint: date format (link)
  2. ^ 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.