Cover image for Abstraction & Programming Languages part 1

Abstraction & Programming Languages part 1

bunnydunker profile image BunnyDunker ・3 min read

Alright, let's have a quick chat on abstraction and programming languages and how we can better understand the technology we are working with. First off abstraction, when it comes to programming languages, is how far removed we are from the way that a computer physically accomplishes what we want it to do. To start talking about this we have to start at the bottom most level of this sort of scale and think of how computers work fundamentally.

Computer mechanics

First off we have the physical computer. Here we can't really talk too much about code because it is all how the computer is physically built. All of the logic comes with how it is physically organized and how the electricity is allowed or not allowed through it. This would be the lowest level of abstraction in the sense that it is the most removed from us as humans.


Our next step up is binary. Here we step into a conceptual and digital representation of how computers process things. It is a series of ones and zeros, corresponding to on / off, true / false, yes / no, and any other binary means of separation. Using this very basic level of logic we can accomplish so many crazy tasks. With binary we are able to pass instructions to a computer in its own language so to speak, and have it understand and do what we want it to do based off of how we built and set it up. To keep it all organized, each 1 and 0 is a bit and eight bits make a byte. Now with a byte we are able to make this grouping of bits correspond to 2^8 or 256 different conceptual things. Through encoding such as ASCII (American Standard Code for Information Interchange) and UTF-8 (Unicode Transformation Format) we are able to have these bytes go from conceptual things to actual characters. Now as you might expect, it is quite difficult to understand and write with binary. Here is how you would write "Hello World!" in binary:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001

Pretty illegible right. In comes our next step up the abstraction ladder.

Low Level Language

Assembly language

With assembly languages we now take a big step closer to a what a modern programmer sees. The short and sweet of how these languages work are by passing the assembly instructions (the code) through an assembler which translates it into machine code, the format the computer needs to understand it. These are really practical because they are extremely fast as the computers don't need to do much to execute it. One of the downsides though is that each assembly language is specific to a particular computer architecture and sometimes an operating system which doesn't allow for easy use.
Here is how you would print out "Hello World!" in Linux Assembly

section .text
   global _start     ;must be declared for linker (ld)

_start:             ;tells linker entry point
   mov  edx,len     ;message length
   mov  ecx,msg     ;message to write
   mov  ebx,1       ;file descriptor (stdout)
   mov  eax,4       ;system call number (sys_write)
   int  0x80        ;call kernel

   mov  eax,1       ;system call number (sys_exit)
   int  0x80        ;call kernel

section .data
msg db 'Hello World!', 0xa  ;string to be printed
len equ $ - msg     ;length of the string

Still not quite easy to use, but a big step from the ones and zeros from the previous level.

See part 2 for high level languages, the outlying esoteric languages, and GUIs

Posted on by:


markdown guide