I'm in a situation with my company where this may be an important distinction.

Is there any distinction between "source code" and "source files" in a technical context?

Is there any distinction between "source code" and "source files" in a legal context?


Edit: I saw some close votes on this. I want to note that this is a possible issue between two companies - and where necessary, we'll definitely use legal counsel. I'm asking this because I'm attempting to be prepared if I'm asked for any technical definitions (as the developer role in this).

  • 7
    #1 Not really. #2 Ask a lawyer. – user40980 Dec 9 '13 at 18:58
  • 5
    Source code could be stored in a database as well or be printed on paper and still be source code. I don't think storage medium makes any difference from a legal view, but if it's important you should ask a lawyer not random people on the internet. – thorsten müller Dec 9 '13 at 19:05
  • @thorstenmüller: You've got a good point about the technical difference between "code" and "file", why not post as an answer? – FrustratedWithFormsDesigner Dec 9 '13 at 19:25
  • 1
    @MichaelT #1: yes, really. See smalltalk. – Thiago Silva Dec 9 '13 at 19:30
  • 1
    Source code is looking at source from the inside, like a programmer. Source file is looking at source from the outside, like a manager or lawyer. – Gilbert Le Blanc Dec 9 '13 at 19:32

Is there any distinction between "source code" and "source files" in a technical context?

My interpretation of this is that a "source file" is a distinct file on a file system that contains source code. "source code" refers to a set of instructions that could be compiled into an executable program, or a library that could be used by a program.

Usually source code is contained in a source file. Cases where this might not be true are situations where a program generates source code in memory and then compiles it. The output object (.exe, .dll, whatever) might be saved to a file, but the generated code might never be saved to a file. If the code generator reads a preferences/configuration file to tell it how to generate the code, I'd call that config file a "source file", but not "source code" since it doesn't get compiled. If the generator operates via a gui and user interaction, then there might not be any source file, and the source code would only exist in memory while the program is running.

A stored procedure is another one which might be tricky: If the author doesn't save the procedure to a file in their local file system, the only other place the code exists is in the database. In Oracle, I think there's actually a table somewhere that stores the code of procedures, but I don't think that data gets stored in a separate table. So in that case, the source code of the procedure is contained in the same file as database data so I don't think you'd have a source file, just source code.

Another situation might be if you have VBA code embedded in an Excel spreadsheet. The spreadsheet contains source code, but it is more than just a source file, as it may also contain data.

Some would say that an example source file that does not contain source code might be something like a DML/DDL file for a database. I'd say they that in a strict sense, they are not source files since they don't get compiled into a program. I might prefer to call them "environment setup files".

Is there any distinction between "source code" and "source files" in a legal context?

I really think you should ask a lawyer who specializes in this area.


Actually, source code and source code files have different meaning.

Source code is defined as,

the computer program code as the programmer originally writes it, using a particular programming language, generally written in a high level-language, such as BASIC, COBOL, or FORTRAN. A program in source code must be changed into object code before the computer can execute it.

Source code is a text material that can be read, printed, converted into executable using programming tool.

Source file on the other hand is just a piece of source code saved in computer system in a particular format.



Source files are anything that is in source control. This could be source code or other types of files such as deployment scripts, content, configuration files, etc. Anything that is produced by your organization that is part of a deployment.

Source code are files that compiled into a DLL or EXE OR a file (script) that is parsed and interpreted at runtime.


From a legal prospective source code/files that are distributed to end users will have a license agreeement that governs its use, distribution, and any corresponding restrictions. You probably have encounted many of these when downloading a product or product update. Usually these are long and written by lawyers to protect the company. In most cases, end users simply click next and install the software.

Additionally, there may be a separate license aggreement on using the source code itself (open source) that governs its use, distribution, and restrictions of using the code for commercial or non-commercial purposes.

If you need to identify any differences between source code/source file it should be defined in the legalese in the licensing agreements for your product/code.

Open source licensing link on WIKIPedia


Simply speaking: yes. There are systems which don't even have files, but of course they have source code. Most Smalltalk systems, for example.

  • Keep in mind that "file" is a metaphor when dealing with computers. Drawing too fine of a distinction between what is and is not a file can get you into a philosophical mess. – Sean McSomething Dec 10 '13 at 11:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.