You are on page 1of 5

10/21/2019 Source code - Wikipedia

Source code
In computing, source code is any collection of code, possibly with comments,
written using[1] a human-readable programming language, usually as plain text.
The source code of a program is specially designed to facilitate the work of
computer programmers, who specify the actions to be performed by a computer Simple C-language source code
mostly by writing source code. The source code is often transformed by an example, a procedural programming
assembler or compiler into binary machine code understood by the computer. The language. The resulting program
machine code might then be stored for execution at a later time. Alternatively, prints "hello, world" on the computer
source code may be interpreted and thus immediately executed. screen. This first known "Hello
world" snippet from the seminal
Most application software is distributed in a form that includes only executable book The C Programming Language
originates from Brian Kernighan in
files. If the source code were included it would be useful to a user, programmer or
the Bell Laboratories in 1974.[1]
a system administrator, any of whom might wish to study or modify the program.

Contents
Definitions
History
Organization
Purposes
Legal aspects
Licensing
Quality
See also
References
External links

Definitions
The Linux Information Project defines source code as:[2]

Source code (also referred to as source or code) is the version of software as it is originally written (i.e., typed into
a computer) by a human in plain text (i.e., human readable alphanumeric characters).

The notion of source code may also be taken more broadly, to include machine code and notations in graphical languages, neither
of which are textual in nature. An example from an article presented on the annual IEEE conference and on Source Code Analysis
and Manipulation:[3]

For the purpose of clarity "source code" is taken to mean any fully executable description of a software system. It is
therefore so construed as to include machine code, very high level languages and executable graphical
representations of systems.[4]

https://en.wikipedia.org/wiki/Source_code 1/5
10/21/2019 Source code - Wikipedia

Often there are several steps of program translation or minification between the original source code typed by a human and an
executable program. While some, like the FSF, argue that an intermediate file "is not real source code and does not count as source
code",[5] others find it convenient to refer to each intermediate file as the source code for the next steps.

History
The earliest programs for stored-program computers were entered in binary through the front panel switches of the computer. This
first-generation programming language had no distinction between source code and machine code.

When IBM first offered software to work with its machine, the source code was provided at no additional charge. At that time, the
cost of developing and supporting software was included in the price of the hardware. For decades, IBM distributed source code
with its software product licenses, until 1983.[6]

Most early computer magazines published source code as type-in programs.

Occasionally the entire source code to a large program is published as a hardback book, such as Computers and Typesetting, vol.
B: TeX, The Program by Donald Knuth, PGP Source Code and Internals by Philip Zimmermann, PC SpeedScript by Randy
Thompson, and µC/OS, The Real-Time Kernel by Jean Labrosse.

Organization
The source code which constitutes a program is usually held in one or more text files stored on a computer's hard disk; usually
these files are carefully arranged into a directory tree, known as a source tree. Source code can also be stored in a database (as is
common for stored procedures) or elsewhere.

The source code for a particular piece of software may be contained in a single file
or many files. Though the practice is uncommon, a program's source code can be
written in different programming languages.[7] For example, a program written
primarily in the C programming language, might have portions written in assembly
language for optimization purposes. It is also possible for some components of a
piece of software to be written and compiled separately, in an arbitrary
programming language, and later integrated into the software using a technique
called library linking. In some languages, such as Java, this can be done at run time
(each class is compiled into a separate file that is linked by the interpreter at
runtime).
A more complex Java source code
Yet another method is to make the main program an interpreter for a programming example. Written in object-oriented
language, either designed specifically for the application in question or general- programming style, it demonstrates
purpose, and then write the bulk of the actual user functionality as macros or other boilerplate code. With prologue
forms of add-ins in this language, an approach taken for example by the GNU comments indicated in red, inline
Emacs text editor. comments indicated in green, and
program statements indicated in
The code base of a computer programming project is the larger collection of all the blue.
source code of all the computer programs which make up the project. It has
become common practice to maintain code bases in version control systems.
Moderately complex software customarily requires the compilation or assembly of several, sometimes dozens or maybe even
hundreds, of different source code files. In these cases, instructions for compilations, such as a Makefile, are included with the
source code. These describe the programming relationships among the source code files, and contain information about how they
are to be compiled.

Purposes
https://en.wikipedia.org/wiki/Source_code 2/5
10/21/2019 Source code - Wikipedia

Source code is primarily used as input to the process that produces an executable program (i.e., it is compiled or interpreted). It is
also used as a method of communicating algorithms between people (e.g., code snippets in books).[8]

Computer programmers often find it helpful to review existing source code to learn about programming techniques.[8] The sharing
of source code between developers is frequently cited as a contributing factor to the maturation of their programming skills.[8]
Some people consider source code an expressive artistic medium.[9]

Porting software to other computer platforms is usually prohibitively difficult without source code. Without the source code for a
particular piece of software, portability is generally computationally expensive. Possible porting options include binary translation
and emulation of the original platform.

Decompilation of an executable program can be used to generate source code, either in assembly code or in a high-level language.

Programmers frequently adapt source code from one piece of software to use in other projects, a concept known as software
reusability.

Legal aspects
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.[10]

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".[11][12]

In 1983 in the United States court case Apple v. Franklin it was ruled that the same applied to object code; and that the Copyright
Act gave computer programs the copyright status of literary works.

In 1999, in the United States court case Bernstein v. United States it was further ruled that source code could be considered a
constitutionally protected form of free speech. Proponents of free speech argued that because source code conveys information to
programmers, is written in a language, and can be used to share humor and other artistic pursuits, it is a protected form of
communication.[13][14][15]

Licensing
An author of a non-trivial work like software,[12] has several exclusive
rights, among them the copyright for the source code and object Copyright notice example:[16]
code.[17] The author has the right and possibility to grant customers Copyright [yyyy] [name of copyright owner]
and users of his software some of his exclusive rights in form of
Licensed under the Apache License, Version 2.0
software licensing. Software, and its accompanying source code, can
(the "License"); you may not use this file except in
be associated with several licensing paradigms; the most important
compliance with the License. You may obtain a
distinction is open source vs proprietary software. This is done by
copy of the License at
including a copyright notice that declares licensing terms. If no notice
is found, then the default of All rights reserved is implied. http://www.apache.org/licenses/LICENSE-
2.0
Generally speaking, software is open source if the source code is free
to use, distribute, modify and study, and proprietary if the source code Unless required by applicable law or agreed to in
is kept secret, or is privately owned and restricted. One of the first writing, software distributed under the License is
software licenses to be published and to explicitly grant these freedoms distributed on an "AS IS" BASIS, WITHOUT
was the GNU General Public License in 1989; the BSD license is WARRANTIES OR CONDITIONS OF ANY
another early example from 1990. KIND, either express or implied. See the License
for the specific language governing permissions
and limitations under the License.

https://en.wikipedia.org/wiki/Source_code 3/5
10/21/2019 Source code - Wikipedia

For proprietary software, the provisions of the various copyright laws,


trade secrecy and patents are used to keep the source code closed. Additionally, many pieces of retail software come with an end-
user license agreement (EULA) which typically prohibits decompilation, reverse engineering, analysis, modification, or
circumventing of copy protection. Types of source code protection—beyond traditional compilation to object code—include code
encryption, code obfuscation or code morphing.

Quality
The way a program is written can have important consequences for its maintainers. Coding conventions, which stress readability
and some language-specific conventions, are aimed at the maintenance of the software source code, which involves debugging and
updating. Other priorities, such as the speed of the program's execution, or the ability to compile the program for multiple
architectures, often make code readability a less important consideration, since code quality generally depends on its purpose.

See also
Bytecode
Code as data
Coding conventions
Computer code
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
1. "Programming in C: A Tutorial" (https://web.archive.org/web/20150223025837/http://cm.bell-labs.com/cm/cs/who/d
mr/ctut.pdf) (PDF). Archived from the original (http://cm.bell-labs.com/cm/cs/who/dmr/ctut.pdf) (PDF) on 23
February 2015.
2. The Linux Information Project. "Source Code Definition" (http://www.linfo.org/source_code.html).
3. SCAM Working Conference (http://www.ieee-scam.org/), 2001–2010.
4. Why Source Code Analysis and Manipulation Will Always Be Important (http://www.cs.ucl.ac.uk/staff/M.Harman/sc
am10.pdf) by Mark Harman, 10th IEEE International Working Conference on Source Code Analysis and
Manipulation (SCAM 2010). Timişoara, Romania, 12–13 September 2010.
5. "gnu.org" (https://www.gnu.org/philosophy/free-sw.en.html). www.gnu.org.
6. Martin Goetz (8 February 1988). "Object-code only: Is IBM playing fair?" (https://books.google.com/books?id=hSBr
PSYgjI4C&printsec=frontcover#v=onepage&q&f=false). Computerworld. Vol. 22 no. 6. p. 59. "It was in 1983 that
IBM reversed its 20-year-old policy of distributing source code with its software product licenses."
7. "Extending and Embedding the Python Interpreter" (https://docs.python.org/extending/). docs.python.org.
8. Spinellis, D: Code Reading: The Open Source Perspective. Addison-Wesley Professional, 2003. ISBN 0-201-
79940-5
9. "Art and Computer Programming" ONLamp.com (http://www.onlamp.com/pub/a/onlamp/2005/06/30/artofprog.htm
l), (2005)

https://en.wikipedia.org/wiki/Source_code 4/5
10/21/2019 Source code - Wikipedia

10. P., Liu, Joseph; L., Dogan, Stacey (2005). "Copyright Law and Subject Matter Specificity: The Case of Computer
Software" (https://lawdigitalcommons.bc.edu/lsfp/536/). New York University Annual Survey of American Law. 61
(2).
11. Apple Computer, Inc. v. Franklin Computer Corporation Puts the Byte Back into Copyright Protection for Computer
Programs (http://digitalcommons.law.ggu.edu/cgi/viewcontent.cgi?article=1344&context=ggulrev) in Golden Gate
University Law Review Volume 14, Issue 2, Article 3 by Jan L. Nussbaum (January 1984)
12. Lemley, Menell, Merges and Samuelson. Software and Internet Law, p. 34.
13. http://cr.yp.to/export/2002/08.02-bernstein-subst.pdf
14. Bernstein v. US Department of Justice (https://www.eff.org/cases/bernstein-v-us-dept-justice) on eff.org
15. EFF at 25: Remembering the Case that established Code as Speech (https://www.eff.org/deeplinks/2015/04/reme
mbering-case-established-code-speech) on EFF.org by Alison Dame-Boyle (16 April 2015)
16. https://www.apache.org/licenses/LICENSE-2.0
17. Hancock, Terry (29 August 2008). "What if copyright didn't apply to binary executables?" (http://www.freesoftware
magazine.com/articles/what_if_copyright_didnt_apply_binary_executables). Free Software Magazine. Retrieved
25 January 2016.

(VEW04) "Using a Decompiler for Real-World Source Recovery", M. Van Emmerik and T. Waddington, the
Working Conference on Reverse Engineering, Delft, Netherlands, 9–12 November 2004. Extended version of the
paper (https://web.archive.org/web/20060108153532/http://www.itee.uq.edu.au/~emmerik/experience_long.pdf).

External links
Source Code Definition (http://www.linfo.org/source_code.html) by The Linux Information Project (LINFO)
"Obligatory accreditation system for IT security products" (http://www.metafilter.com/75061/Obligatory-accreditatio
n-system-for-IT-security-products). MetaFilter.com. 22 September 2008. "will introduce rules requiring foreign firms
to disclose secret information about digital household appliances and other products from May next year, the
Yomiuri Shimbun said, citing unnamed sources. If a company refuses to disclose information, China would ban it
from exporting the product to the Chinese market or producing or selling it in China, the paper said."
Same program written in multiple languages (http://rosettacode.org/wiki/Main_Page)
Javascript Obfuscator (https://javascript-obfuscator.org/)

Retrieved from "https://en.wikipedia.org/w/index.php?title=Source_code&oldid=920639575"

This page was last edited on 11 October 2019, at 00:39 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using
this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia
Foundation, Inc., a non-profit organization.

https://en.wikipedia.org/wiki/Source_code 5/5

You might also like