# Abstraction Layers: From Atoms to Apps

Computers are awesome. They do so much for us, and they’re so fast! But how do they work? We all know that computers only understand ones and zeroes, but what does that really mean? How does a computer work?

In computing there exists the idea of an abstraction layer. An abstraction layer is an encapsulation of a particular set of functionality. Each layer has a public interface and a hidden implementation. Put simply, abstraction layers help us reason about how a computer works from the bottom up.

There’s a lot there. Personally I would put physics into its own section called “Physical Reality”, and below that I would create a new section called “Abstract Reality” containing mathematics, computer science, and philosophy.

#### Electronics/Hardware

Electronics is the branch of physics and technology concerned with the design of circuits using transistors and microchips, and with the behavior and movement of electrons in a semiconductor, conductor, vacuum, or gas.

Electricity
Electrical currents flow from areas of high voltage (electric potential) to low voltage.

Transistors
Below are the symbols for n-MOS and p-MOS transistors. These are the building blocks of electronic devices. Let’s take a look at the n-MOS. Imagine that node D has a high voltage and node S has a low voltage. Node G is the gate node. When node G has a low voltage, the gate is open and current does not flow. When node G has a high voltage, the gate is closed and current flows. The p-MOS works in the opposite way.

It gets more interesting when you connect several of these MOSFETs together. The following configuration is known as an AND gate. The output will be high only when both the A and B inputs are high. Other gates exist, such as NOT, OR, XOR, NAND, and NOR.

The circuit schematic above can be abstracted into a new symbol (shown below).

Once we get to this level we no longer need to think about high or low voltages. We abstract the concept of flowing electrical currents into a high value (1) and low value (0). Essentially we have made a leap from working with electricity to working with numbers.

Several gates can be combined to provide new functionality. In the diagram below we used two XOR gates, two AND gates, and an OR gate to make an adder circuit. It’s called an adder because it adds binary numbers.

The above adder only adds two bits. That’s not very useful because it restricts the output range to the values 0–2. The design below is a 4-bit adder.

That design looks pretty complicated. We can abstract that into another simpler symbol.

Just from looking at it, you know that it’s an adder circuit. Someone who is designing the architecture of a computer does not need to concern himself with understanding how it is implemented. All that he needs to understand is the interface.

There are many other electronic components made from logic gates. Arranging electronic components in a specific way gives rise to a CPU.

Here’s a cool video of zooming into a microchip.

#### Software

Instruction Set Architecture (ISA) / Assembly Language
The ISA is a protocol that defines how a computer processes bits. Essentially an instruction set is a list of operations that the CPU knows how to perform. It is specific to the CPU. ISA is very closely related to assembly language.
Ex: ARM, x86, PowerPC

Operating System (OS)
The operating system is a collection of software that provides a platform for developers to work on. The OS manages all of the software and hardware on the computer.
Ex: MacOS, Windows 8, Ubuntu

Application Software
This is where we developers work. While we do sometimes need to concern ourselves with the OS, most of our time is spent working at this high level.

As a developer it’s nice to not have to think about physics, circuits, and machine code. However, I think it’s important to at least recognize that everything you as a developer are able to do is only possible because the tools we have built at the lower levels.

It’s also really cool to think about the future and where technology is going. Developments in the bottom layers of hierarchy will eventually ripple out enabling developers to build cool applications to make our users happy! :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.