Data (computing)
From Wikipedia, the free encyclopedia
In computer science, data is often distinguished from programs. A program is a set of instructions that detail a computation or task for the computer to perform. Data is everything that is not program code. Data is information before it has been given any context, structure and meaning. An example would be; 03091989. At first, this has no meaning, but if we put it into context, such as 03/09/1989, we suddenly see that it is a date format. But this still has no meaning, so if we say; 03/09/1989 - the date of birth, we have successfully transformed 03091989 into a more understandable format.
[edit] Explanation
In most modern digital computers, both programs and data are stored using the same facilities (RAM, hard disk, etc.). This is called a Von Neumann architecture design, and is what most people think of as a "computer". Some computers use separate storage for programs vs data; these are called Harvard architecture computers, and are relatively rare. There are also computers with a fixed program; in these, the only thing that changes is the data. A simple desk calculator is a good example; it can only perform the basic functions it was programmed with at the factory.
Typically, different files will be used to store programs vs data. For example: A user might first instruct the operating system to load a word processor program from one file, and then edit a document stored in another file. In this example, the document would be data. If the word processor also features a spell checker, then the dictionary (word list) for the spell checker would also be considered data. The algorithms used by the spell checker to suggest corrections would be considered code.
The line between code and data can become blurry. An interpreter, for example, is a program. The input data to an interpreter is itself a program -- just not one expressed in native machine language.
In many modern system designs, programs are sectioned into different segments. A data segment (when present) will contain data. The initial values are set by the programmer at compile-time. The running program can generally modify values in the data segment, but cannot change the size of the data segment.
[edit] A more fundamental view
More fundamentally in programming, data is any evolving state. Code is a particular, very structured kind of data, which constitutes a way to specify what is being programmed. Code is specific in that it has a particular structure, imposed by the designer of the system which executes it. Sometimes, this structure is the only way to specify the behavior of a program. The notion that code is also data is harnessed in the design of functional languages to establish so-called expressive power.