This article introduces computer science fundamentals related to data storage and interchange within programming languages.

The goal is to expose computer science fundamentals from a high-level for those who have not had prior exposure to concepts.

What are computer science fundamentals?

They are basic theory relating to the operation of computational devices and performing repeatable computation. The forefather of modern computational theory is none other than Alan Turing.


In programming languages, variables are used to store data. They are called variables simply because their values can differ and change throughout the course of a program’s execution. Variables whose values are intended to remain the same throughout the course of execution are naturally called constants.

By now, hopefully you have noticed the similarity between functions in programming and mathematical functions.

For example, in the general-form linear function f(x) = mx + b, the function f has x as its variable input. The variable x denotes any real number as an input.

While the above mathematical function operates on real numbers, programming functions operate on data of varying types.

Data Encoding

All data is stored as encoded binary within a computer’s hardware. The actual value of data depends on its encoding, or “how” it should be interpreted. Any binary string can be interpreted in any number of ways.

For example, the binary string that represents lowercase “h” in ASCII (American Standard Code for Information Interchange) is 0110 1000.

The binary string 0110 1000 can be denoted in hexadecimal (base-16) as 0x68. Note that the prefixed 0x is simply a convention which denotes that the number is base-16.

Moreover, the binary string 0110 1000 and the hex 0x68 can both be interpreted as an integer using two’s complement, a mathematical scheme for interpreting binary data as integers.

In the two’s complement scheme, 0110 1000 and 0x68 are both equal to the integer 104.

In a nutshell:

0110 1000 = 0x68 = 104 = "h

What binary data represents boils down to its encoding. The “encoding” of data is a piece of metadata (virtual or descriptive data) that indicates: “this data should be interpreted in this way.”

Data Typing

There are quite a few different ways to interpret binary data. Common schemes in programming languages are:

  • two’s complement, the mathematical standard for representing integers
  • IEEE 754 floating point, the international standard for floating point or decimal numbers
  • ASCII, the American Standard Code for Information Interchange for strings

Note: IEEE is typically pronounced “eye triple E”.

The reason for the widespread support of two’s complement integers and IEEE 754 floating point boils down to one thing: hardware.

Many microprocessors have dedicated and fast hardware for computing arithmetic operations on two’s complement integers and floating point numbers.

For example, the GPU on your phone or your favorite video-game console have performance metrics measured in FLOPS or floating-point operations per second.

This specifically refers to how many IEEE 754 floating-point arithmetic operations the hardware can compute in a given unit of time.

It is important to understand that many programming languages are strictly typed. That is, when you define a variable argument to a function, you must explicitly declare within the programming language the encoding for that argument: how the programming language should interpret the data contained in the variable.

For example, in the C programming language, we could have a function:

int add2(int num) {
    return num + 2

This function simply takes an integer input, adds two (2), and returns the summed value as an integer.

Notice how the argument is being explicitly typed as an integer variable. This is done by prefixing the name of the variable with its type: int num.

In addition, notice how the return value of the function itself is explicitly defined by prefixing the function name add2 with int.

Typing in Python

Unlike other strictly-typed programming languages, Python is duck-typed. This means it is not necessary to explicitly define the return types of functions or the typing of their arguments.

Instead, the typing of data passed around is inherently bound to the data itself.


Leave a Reply

Your email address will not be published. Required fields are marked *