Document – Data – Code: What Is the Difference?

Document, Data, and Code are three essential words in computing; however, it is often so easy to misuse them.
The word “document” is often used interchangeably with “data”; however, the two words have some subtle differences. Moreover, “code” is commonly used purely as a technical term but has some significant similarities with data.
Hence, this article will elucidate the differences and similarities that exist between Document, Data, and Code.
First up, Document.
What is a Document?
A document is simply a page used to contain text, or graphics, or both.
For example, in the image below, the piece of paper with the text “phone a friend” is a document because it contains some text and drawing. However, papers are not the only type of documents.

Types of Documents
Digital pages and Paper pages are the two main document types for holding data.
But you may ask: “Is data not equivalent to a document?” — Not at all!
Let’s take a closer look at data.

What is Data?
Data is the content of a document. In order words, the text and graphics on a page are the document’s data.
So, while a document is a container, data is the content of that container.

Types of Data
The most common types of data are:
- Graphical Data: the visual contents of a page, such as diagrams, charts, videos, and images.
- Audio Data: the sound recorded contents of a page, such as WAV, MP3, and AAC.
- Textual Data: the written contents of a page, such as letters (e.g. A, B, C), numbers (e.g., 1, 2, 3), symbols (e.g., $, #, +), and codes (e.g.,
<input>
,body { background: #A18A77; }
,if (condition) { //execute code }
).
But hang on a sec, if a document is a page, and data is the content of a page, what then is a code?
Code demystified
A code is any language that computers can understand and process.
In other words, code = computer’s language.
There are several types of codes, but the common types are HTML, CSS, JavaScript, and Python.
In summary
A document is a page for holding data.
But data is the content of a document.
And code is the data that computers understand.
Credit
Featured Image: Stayhome TODO list by Markus Spiske