The source code is the specification of a program that: * the programmer directly manipulates (via some editor) * the computer "understands" (is machine readable and executable (or transformable into such)) For example, if you have a pure C program, it's all the *.c and *.h files. However, if a.c and a.h are produced by another tool (e.g. yacc/lex), then a.c and a.h aren't source code, but a.y (the input to yacc) is. ---- Actually, '''TheSourceCodeIsTheDesign'''. ''As has been argued repeatedly, it most assuredly is not. But that's what we're here to discuss, isn't it?'' ---- Source code is the intermediate representation between what's in the programmer's head and what the machine can execute. It is more-or-less: * Human writable * Human readable It is required to be: * Machine readable * Machine executable (or transformable into such) Programming languages attempt to improve the human IO, especially the human readable component. They also connect human writable to machine readable. This requires a certain amount of 'slack' since what's in the programmer's head isn't usually in a machine executable format. Compilers attempt to provide us this slack by automating the transformation into machine executable. ---- It doesn't have to be written in what people usually think of as a "programming language". It can also be the files that a GUI builder uses to remember its state between sessions. These are machine readable and transformable into machine executable. They are often not human writable or readable without the GUI builder program. In this case, the GUI builder program is essentially an editor (and maybe a compiler). Another example is a CASE tool used to generate code in some traditional programming language (such as C or C++). The generated code is not source code even though it may be human writable and readable, and machine readable and executable. It's generated by a tool, and it's not the representation that the programmer is working with. The source code in this case is the files that the CASE tool uses to remember its state between sessions. ''I have yet to see program maintenance done with a CASE tool. The ASCII files containing programming language constructs are the source code. These are the files that communicate the program to future developers and maintainers, not a series of UML diagrams that could be easily derived from the source code.'' Yes, of course, but the original definition is still valid. When the programmers start working directly on the generated files, the CASE tool's state files simply become the old version of the source code. The new version of the source code is the (now edited) files that the programmers are editing. ---- Maybe this page should be merged with WhatIsSourceCode. ---- CategoryDefinition