Wikisage, the free encyclopedia of the second generation, is digital heritage

Source code

From Wikisage
Revision as of 22:00, 25 July 2009 by Andrew (talk | contribs) (New page: '''Source code''' (commonly called ''source'' or ''code'') is a collection of statements or declarations written in a human-readable computer programming language. Together these descr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source code (commonly called source or code) is a collection of statements or declarations written in a human-readable computer programming language. Together these describe the instructions that will make up the resulting computer program or functionality that can be used in another program. In several instances like e.g. PHP the source code also functions as the program.

Source code is usually contained in one or more plain text files. It may be converted into an executable format by a compiler or be executed on the fly by an interpreter.

Usage

The primary use of source code is as input to produce an executable program (either compiled or interpreted). It is also used to communicate functionality and algorithms between people that may further develop these or incorporate them partly into other projects, known as reusing code.

Code organization

The source code for a program or part of a program may be stored in a single file or in many files. It is possible to compile the individual components of a program separately (incremental compilation) into object code and link the resultant object files together into a single executable file. This is done as compilation of large projects can often take up a lot of time that could be spent more productively. A change to one part of a program would otherwise require all the source code to be recompiled but instead only one component needs to be recompiled before linking all components again.

A program's source code isn't necessarily written in the same programming language. Individual components may be written in a language more suitable to their application, e.g. system functions and optimizations are usually written in assembly language. Header files describe how components must be used in other components that depend on their functionality. Many programming languages contain large libraries of precompiled code providing common functionality that can be linked into programs.

Licensing

Software may either be released as proprietary or open source. Proprietary software has a restrictive license that allows very limited use. Source code for such software is usually not released to the public or anybody not working on the software project. The source code for open source software is available to the public at large to reuse or change and release into the public again. Such source code may be released under a share-alike or "copy left" license or may have other restrictions like attributing any usage of it to the author or requiring that any modifications be released under the same license.

Free software, also called "freeware" is usually free to use with some restrictions but the source code for such programs does not necessarily have to be released. As with any creative works source code falls under intellectual property and unless otherwise specified the legal owner retains all copyright to use and duplicate it. Releasing source code does not constitute an endorsement to use it unless expressly specified by the author or legal owner at the time of such expression.