HOME

TheInfoList




In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software. It has sci ...

computing
, source code is any collection of code, with or without comments, written using a ''human-readable''
programming language A programming language is a formal language In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calcu ...

programming language
, usually as
plain text In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softw ...

plain text
. The source code of a program is specially designed to facilitate the work of computer
programmer A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software Software is a collection of Instruction (computer science) ...

programmer
s, who specify the actions to be performed by a computer mostly by writing source code. The source code is often transformed by an
assembler Assembler may refer to: Arts and media * Nobukazu Takemura Nobukazu Takemura (竹村延和 ''Takemura Nobukazu'') is a Japanese musician and artist. Born in Hirakata, Osaka in August 1968, he became interested in music at a young age by listenin ...
or
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiler
into
binary Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
that can be executed by the computer. The machine code might then be stored for
execution Capital punishment, also known as the death penalty, is the state State may refer to: Arts, entertainment, and media Literature * ''State Magazine'', a monthly magazine published by the U.S. Department of State * The State (newspaper), '' ...
at a later time. Alternatively, source code may be interpreted and thus immediately executed. Most
application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end-users. Examples of an application Application may refer ...
is distributed in a form that includes only
executable In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...
files. If the source code were included it would be useful to a user, programmer, or a
system administrator A system administrator, or sysadmin, or admin is a person who is responsible for the upkeep, configuration, and reliable operation of computer systems A computer is a machine A machine is a man-made device that uses power to apply ...
, any of whom might wish to study or modify the program.


Definitions

The
Linux Linux ( or ) is a family of open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product ...

Linux
Information Project defines source code as:
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 In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softw ...

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:
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.
Often there are several steps of
program translation A translator or programming language processor is a generic term that can refer to anything that converts code from one computer language into another. A program written in high-level language is called source program. These include translations ...
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", 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 computer A stored-program computer is a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer pro ...
s were entered in binary through the
front panel Front may refer to: Arts, entertainment, and media Films * ''The Front'' (1943 film), a 1943 Soviet drama film * ''The Front ''The Front'' is a 1976 comedy-drama Comedy-drama, or dramedy, is a genre of dramatic works that combines elements ...

front panel
switches of the computer. This
first-generation programming language A first-generation programming language (1GL) is a machine-level programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. ...
had no distinction between source code and
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
. 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. Most early computer magazines published source code as
type-in program A type-in program or type-in listing was computer source code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic proce ...
s. 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 Donald Ervin Knuth ( ; born January 10, 1938) is an American computer scientist A computer scientist is a person A person (plural people or persons) is a being that has certain capacities or attributes such as reason, morality, consciousnes ...
, ''PGP Source Code and Internals'' by
Philip Zimmermann Philip R. Zimmermann (born 1954) is an American computer scientist and cryptographer. He is the creator of Pretty Good Privacy Pretty Good Privacy (PGP) is an encryption software, encryption program that provides cryptographic privacy and a ...
, ''PC SpeedScript'' by
Randy Thompson Randy Thompson is a Virginia Virginia (), officially the Commonwealth of Virginia, is a in the and regions of the , between the and the . The geography and climate of the are shaped by the and the , which provide habitat for much of ...
, 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 file A text file (sometimes spelled textfile; an old alternative name is flatfile) is a kind of computer file A computer file is a computer resource for recording data Data (; ) are individual facts, statistics, or items of information, oft ...
s stored on a computer's
hard disk A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device On a reel-to-reel tape recorder (Sony TC-630), the recorder is data storage equipment and the magnetic tape is a data stora ...

hard disk
; usually, these files are carefully arranged into a
directory tree In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders, or drawers, analogy, analogous to a workbench or ...
, known as a source tree. Source code can also be stored in a database (as is common for
stored procedure A stored procedure (also termed proc, storp, sproc, StoPro, StoredProc, StoreProc, sp, or SP) is a subroutine available to applications that access a relational database management system (RDBMS). Such procedures are stored in the database data d ...
s) 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. For example, a program written primarily in the
C programming language C (, as in the letter ''c'') is a general-purpose, procedural computer programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/outp ...
, might have portions written in
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
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
library linking
. In some languages, such as
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
, this can be done at run time (each class is compiled into a separate file that is linked by the interpreter at runtime). Yet another method is to make the main program an interpreter for a programming language, either designed specifically for the application in question or general-purpose and then write the bulk of the actual user functionality as macros or other forms of add-ins in this language, an approach taken for example by the
GNU Emacs GNU Emacs is a free software text editor. It was created by GNU Project founder Richard Stallman. In common with other varieties of Emacs, GNU Emacs is extensible using a Turing complete programming language. GNU Emacs has been called "the most p ...
text editor. The code base of a
computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, generating algorithms, Profilin ...
project is the larger collection of all the source code of all the
computer program In imperative programming, a computer program is a sequence of instructions in a programming language that a computer can execute or interpret. In declarative programming, a ''computer program'' is a Set (mathematics), set of instructions. A comp ...
s which make up the project. It has become common practice to maintain code bases in
version control system In software engineering, version control (also known as revision control, source control, or source code management) is a class of systems responsible for managing changes to computer programs, documents, large web sites, or other collections of ...
s. 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 In software development, Make is a build automation tool that automatically Software build, builds executable programs and library (software), libraries from source code by reading file (computing), files called ''Makefiles'' which specify how to ...
, 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

Source code is primarily used as input to the process that produces an executable program (i.e., it is
compiled In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiled
or interpreted). It is also used as a method of communicating
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...

algorithm
s between people (e.g.,
code snippets Snippet is a programming term for a small region of re-usable source code, machine code, or text. Ordinarily, these are formally defined operative units to incorporate into larger Module (programming), programming modules. Snippet management is a ...
in books).Spinellis, D: ''Code Reading: The Open Source Perspective''. Addison-Wesley Professional, 2003.
Computer programmers A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software Software is a collection of Instruction (computer science ...

Computer programmers
often find it helpful to review existing source code to learn about programming techniques. The sharing of source code between developers is frequently cited as a contributing factor to the maturation of their programming skills. Some people consider source code an expressive
artistic medium Arts media is the material and tools used by an artist, composer or designer to Creativity, create a work of art, for example, "pen and ink" where the pen is the tool and the ink is the material. Here is a list of types of art and the media used wit ...
.
Porting In software engineering Software engineering is the systematic application of engineering approaches to the software development, development of software. A software engineer is a person who applies the principles of software engineering to desi ...
software to other
computer platform A computing platform or digital platform is an environment in which a piece of software Software is a collection of instructions that tell a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or ...
s 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 In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software ...
and emulation of the original platform.
Decompilation A decompiler is a computer program that takes an executable file as input, and attempts to create a high level Source code, source file which can be binary recompiler, recompiled successfully. It is therefore the opposite of a compiler, which takes ...
of an executable program can be used to generate source code, either in
assembly code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, genera ...
or in a
high-level language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
. 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
copyright Copyright is a type of intellectual property Intellectual property (IP) is a category of property Property is a system of rights that gives people legal control of valuable things, and also refers to the valuable things themselves. ...

copyright
able and therefore always
public domain software Public-domain software is software Software is a collection of Instruction (computer science), instructions and data (computing), data that tell a computer how to work. This is in contrast to Computer hardware, physical hardware, from which the ...
. 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".Lemley, Menell, Merges and Samuelson. ''Software and Internet Law'', p. 34. In 1983 in the United States court case ''
Apple v. Franklin ''Apple Computer, Inc. v. Franklin Computer Corp.'', 714 F.2d 1240 ( 3d Cir. 1983), was the first time an appellate level court in the United States The United States of America (USA), commonly known as the United States (U.S. or US), or Am ...
'' it was ruled that the same applied to
object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and sof ...
; 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 Freedom of speech is a principle that supports the freedom Freedom, generally, is having the ability to act or change without constraint. Something is "free" if it can change easily and is not constrained in its present state. In philoso ...

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.EFF at 25: Remembering the Case that established Code as Speech
on EFF.org by Alison Dame-Boyle (16 April 2015)


Licensing

An author of a non-trivial work like software, has several
exclusive right In Anglo-Saxon law Anglo-Saxon law (Old English Old English (, ), or Anglo-Saxon, is the earliest recorded form of the English language English is a West Germanic languages, West Germanic language first spoken in History of Anglo-Saxon ...
s, among them the copyright for the source code and
object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and sof ...
. The author has the right and possibility to grant customers and users of his software some of his exclusive rights in form of
software licensing A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, all software is copyright protected, in both source c ...
. Software, and its accompanying source code, can be associated with several licensing paradigms; the most important distinction is
free software Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty ...

free software
vs
proprietary software Proprietary software, also known as non-free software or closed-source software, is computer software for which the software's publisher or another person reserves some rights from licenses to use, modify, share modifications, or share the softwa ...
. This is done by including a
copyright notice In Copyright law of the United States, United States copyright law, a copyright notice is a notice of statutorily prescribed form that informs users of the underlying claim to copyright ownership in a published work. Copyright is a form of prote ...
that declares licensing terms. If no notice is found, then the default of ''
All rights reserved "All rights reserved" is a copyright formality indicating that the copyright holder ''reserves'', or holds for its own use, all the rights provided by copyright law Copyright is a type of intellectual property that gives its owner the exclu ...

All rights reserved
'' is implied. Generally speaking, a software is free software if its users are free to use it for any purpose, study and change its source code, give or sell its exact copies, and give or sell its modified copies. Software is ''proprietary'' if it is distributed while the source code is kept secret, or is privately owned and restricted. One of the first software licenses to be published and to explicitly grant these freedoms was the
GNU General Public License The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software license A free-software license is a notice that grants the recipient of a piece of software extensive rights to modify and software distribu ...
in 1989; the
BSD license BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft Copyleft is the practice of granting the right to freely distrib ...
is another early example from 1990. For proprietary software, the provisions of the various copyright laws, trade secrecy and
patent A patent is a type of intellectual property Intellectual property (IP) is a category of property Property is a system of rights that gives people legal control of valuable things, and also refers to the valuable things themselves. Depe ...

patent
s are used to keep the source code closed. Additionally, many pieces of
retail softwareRetail software is computer software Software is a collection of Instruction (computer science), instructions and data (computing), data that tell a computer how to work. This is in contrast to Computer hardware, physical hardware, from which th ...
come with an
end-user license agreement An end-user license agreement (EULA, ) is a legal contract entered into between a software developer A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is ...
(EULA) which typically prohibits
decompilation A decompiler is a computer program that takes an executable file as input, and attempts to create a high level Source code, source file which can be binary recompiler, recompiled successfully. It is therefore the opposite of a compiler, which takes ...
,
reverse engineering Reverse engineering (also known as backwards engineering or back engineering) is a process or method through the application of which one attempts to understand through deductive reasoning Deductive reasoning, also deductive logic, is the process ...

reverse engineering
, analysis, modification, or circumventing of
copy protection Copy protection, also known as content protection, copy prevention and copy restriction, describes measures to enforce copyright Copyright is a type of intellectual property Intellectual property (IP) is a category of property that in ...
. Types of source code protection—beyond traditional to
object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and sof ...
—include code encryption,
code obfuscation In software development, obfuscation is the deliberate act of creating source code, source or machine code that is difficult for humans to understand. Like obfuscation in natural language, it may use needlessly roundabout expressions to compose ...
or
code morphing Code morphing is an approach used in obfuscating software to protect software applications from reverse engineering, analysis, modifications, and cracking. This technology protects intermediate level code such as compiled from Java and .NET languag ...
.


Quality

The way a program is written can have important consequences for its maintainers.
Coding conventions Coding conventions are a set of guidelines for a specific programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), ...
, which stress
readability Readability is the ease with which a reader can understand a written text. In natural language, the readability of text depends on its content (the complexity of its vocabulary A vocabulary, also known as a wordstock or word-stock, is a ...

readability
and some language-specific conventions, are aimed at the maintenance of the software source code, which involves
debugging In computer programming Computer programming is the process of designing and building an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, caus ...

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 Bytecode, also termed portable code or p-code, is a form of instruction set In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions ...
* Code as data *
Coding conventions Coding conventions are a set of guidelines for a specific programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), ...
*
Computer code A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can be driven by animals and people A people is a plurality of person A person (plural ...
*
Free software Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty ...

Free software
*
Legacy code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and soft ...
*
Machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
*
Markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntactically distinguishable from the text, meaning when the document is processed for di ...
*
Obfuscated code In software development Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software compone ...
*
Object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and sof ...
*
Open-source software Open-source software (OSS) is computer software Software is a collection of instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Co ...
*
Package (package management system) A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer A computer is a machine that can be programmed ...
*
Programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science) ...

Programming language
*
Source code repository In revision control systems, a repository is a data structure that stores metadata Metadata is " data" that provides information about other data". In other words, it is "data about data". Many distinct types of metadata exist, including descri ...
*
Syntax highlighting Syntax highlighting is a feature of text editor A text editor is a type of that edits . Such programs are sometimes known as "notepad" software, following the naming of . Text editors are provided with s and software development packages, ...
*
Visual programming language In computing, a visual programming language (VPL) is any programming language that lets users create computer program, programs by manipulating program elements ''graphically'' rather than by specifying them ''textually''. A VPL allows programmin ...


References


Sources

* (VEW04) "Using a Decompiler for Real-World Source Recovery", M. Van Emmerik and T. Waddington, the ''Working Conference on Reverse Engineering'',
Delft Delft () is a city A city is a large human settlement.Goodall, B. (1987) ''The Penguin Dictionary of Human Geography''. London: Penguin.Kuper, A. and Kuper, J., eds (1996) ''The Social Science Encyclopedia''. 2nd edition. London: Routledge. ...

Delft
,
Netherlands ) , national_anthem = ( en, "William of Nassau") , image_map = EU-Netherlands.svg , map_caption = , image_map2 = BES islands location map.svg , map_caption2 = , image_map3 ...

Netherlands
, 9–12 November 2004
Extended version of the paper


External links



by The Linux Information Project (LINFO) *
Same program written in multiple languages

Javascript Obfuscator
{{DEFAULTSORT:Source Code Text