Markus was frolicking through the park, when suddenly he saw an envelope laying on his path. Someone must have lost it, he thought. He picked it up, viewed from both sides, but unfortunately it was blank and snowy white. Inside, there was a piece of paper with a handwritten number 24. That’s it. He got confused because why would anyone carry such a weird package?
Story of Some Value
Two things are certain. First, at least one person knows the meaning of this letter. Second, the number of possible explanations for this item is practically infinite. 24? 24 of what? Is it a distance, a count, or a weight? Does it represent a calculable physical object, or does it refer to something abstract and ethereal? How important is it to the person who lost it? What about the recipient? Does the method of delivery matter, or is it meant to be delivered on a specific day of the week? Or a particular day of the month? Enough questions, something is missing here. That thing is Context. And what is the Context for this letter incident?
The history behind this letter is quite trivial. It was dropped by a doctor named John Scalpel on his way home. It was a message given to him by his patient, Mr. Ill, stating how many doughnuts he had last week. If the number is significant, as in this case, Mr. Ill will receive an unpleasant phone call from his doctor, reminding him about his diabetes. Poor Mr. Ill.
Data Types
Before I gave you the Context, what you had was pure, meaningless Data. Now, what you have is Information. It tells us that someone eats too much sugar in a situation where they should avoid it. Data is nothing more than a raw, indifferent set of representations recognizable by humans.
These representations are categorized based on their intended interpretation, introducing the concept of Data Types. Now, we will dive into three of the most basic ones. Keep in mind that the definitions you are about to learn are designed to be readable and understandable by humans. This means you can interpret them directly by looking at the values on a screen.
Boolean
A Boolean represents only two states: true or false. It may be represented in various ways, such as 1 and 0, yes and no, or words like “on” and “off.” It may even be symbolized by an LED that is either flashing or not. What matters is that this single bit of data is passed to a human or another system, where it will be used as a piece of Information.
Number
Whenever you, as a programmer, intend to pass some countable value, you need to use the Number type. What do I mean by countable? If you can perform basic mathematical operations - such as addition and subtraction, on this Data, then you are dealing with a countable value. Simply put: a Number. This type can be represented using any numbering system I introduced in previous posts.
For example, consider the number of cars in a train. If there are more than 40 wagons, a more powerful locomotive must be used. In this case, Information is born in the Context of the Train Depot responsible for this particular train’s departure.
Character and String
So far, we have learned about Data Types that tell us if something exists or not and another type that represents a countable value. The missing piece here is text, the same kind you find in books, newspapers, or on a computer screen.
A String may seem like a funny name, but if you think about it, you might ask: “A string of what exactly?” It
refers to a sequence of characters, and a Character is the smallest building block of a String. In programming,
Strings are typically enclosed in quotes, single ('string'
) or double ("string"
). In this blog, we will use double
quotes (""
).
For example, consider the simple String:
"Hello"
This String contains five characters:
"H"
"e"
"l"
"l"
"o"
Each Character in this sequence is also a String of length one. To represent a Character, we also use quotes, two in our case. When these five Characters/Strings are concatenated (we don’t add strings; we concatenate them instead, this term distinguishes operations between Data Types), they form a longer String.
Summary
You have learned a fundamental concept in IT: Data and its Types. Types reflect the intention of how Data should be read and interpreted. Data may represent something to be read, something to be calculated, or a simple binary state. When Data is placed into a Context, it becomes Information.