Arrowmail - Email Services for today's Business










Also On This Page

 

Layers of Abstraction


This article is a little more philosophical than you usually find on this site.
In computing it's important to operate with the appropriate number of layers of abstraction: too few and you're drowning in complexity; too many and you're locked into a simplistic world without the power to achieve your goals.

I feel a definition is already way overdue:-

A layer of abstraction is a method of wrapping up and hiding the underlying complexity of a system so that it can be thought of as something simpler, sometimes using an analogy, so that humans can more easily understand and deal with it.
The complexity still exists but if the layer of abstraction allows us to do everything we need, we can operate as if the layer of abstraction is the whole system and never consider what is actually going on.
This usually results in the job getting done more quickly.

A layer of abstraction is like zooming out:-
A powerful microscope may show us individual atoms and molecules but when we zoom out we see a human cell.
Zooming out further we eventually just see the human.



"Writing" as an example of Layers of Abstraction

I'm writing this with a pen (yes, really). When I've composed the next sentence in my head I'll will the pen to write the individual words.
Several layers of abstraction are at work here.
The lowest layer is the one that coordinates the muscles in my fingers, hand and arm to move the pen to draw the, perhaps, 100 different symbols used in writing English.
(This could be seen as an abstraction from the nerve impulses and chemical reactions that make the parts of my body move.)
The next layer up connects words to symbols - I'm normally not consciously involved with spelling, capitalisation or punctuation.
Without these layers of abstraction, writing would be so painfully slow as to make it an impractical means of communication.

It took many years of practice to be able to operate at this "just composing sentences" level of writing and I'm by no means perfect at it, having to make regular trips down a layer or two to check a spelling, consider if it's a comma or a semi-colon that's required, or even deeper to try and stop my "n"s looking like "m"s.
Drawing symbols is learnt when we first start school, spelling and punctuation gradually follow and proficiency is not normally achieved until our teens.
Interestingly, the rise of the typewriter and then the keyboard and word processing software has meant we also have to learn an alternative to the "symbol drawing" layer: moving our fingers around a keyboard to press buttons which produce perfect symbols every time.
The original "sentence composing" and "spelling and punctuation" layers still sit above this new "symbol drawing" layer.
More recent innovations such as "spell-check as you type" and "autocorrect" compensate for our lack of dexterity in pressing keys in the wrong order, double-pressing or not pressing hard enough as well as, at the next layer up, pointing out spelling errors.
Those green squiggly lines are even trying to interfere, at the top level of sentence composition, with their helpful suggestions such as "Fragment - consider revising" - although it beats me what good those purple dots are.



Form Letters

In our writing example I can identify an even higher layer of abstraction to "composing sentences" which perhaps starts to show signs of a layer too far.
Form Letters are carefully prepared full documents that can be re-used on different occasions to save time preparing a new one each time.
Sending a form letter that purports to be an individually crafted reply has an air of dishonesty about it.
The form letters I receive are usually not very helpful and sometimes just irrelevant.
I admit to using form letters myself but always try to start with an original, personalised sentence to cover my tracks.
If I don't have a form letter prepared that fits I just have to compose an original reply.

If a customer service department has a strict policy of only sending out form letters in reply to customer queries then the people there are operating at too high a layer of abstraction for effective written communication.

The worst example of this are my children's school reports that are now constructed of "approved sentences" guaranteed not to offend and which express deficiencies and failures in only positive terms.
There must be some despicable program that generates them or else teachers have been replaced by politically correct robots.
This has so debased school reports that I now only skim through them looking for exam marks and the odd personal comment.
See the following example from my 11 year old daughter's recent school report:-






A
Layer of Abstraction
is sometimes
called a
Metaphor

Extract of Year 6 School Report  


Layers of Abstraction in Computing

Anyway, back to computers which are pretty abstract things and one of the few fields of endeavour where new layers of abstraction are regularly being developed.
How many layers of abstraction does the Windows Desktop represent?



The First Program to be Written

In the 70s and 80s when new processors and types of computers were being invented such as the Sinclair Spectrum, Commodore 64 and IBM PC, after the hardware engineers had hammered out their specifications and handed over to the software writers, what was the first program they wrote?


1 -

A text editor

2 -

A word processor

3 -

A high-level computer language

4 -

An operating system

5 -

A game


Presented with a raw computer for which no software at all exists you're forced to program in machine code where, if you make a mistake or decide to add something later on you have the painful process of shuffling your code along, recalculating addresses.
You are in desperate need of a layer of abstraction and so this is what you write first.
The program is called an "assembler" and, armed with this, although you are still programming at the level of individual processor instructions, the human way of working with trial and error and revising and refining can proceed more smoothly.
Question: What's the second program you write with your new assembler?
Answer: A better assembler.
Then you can go on, eventually, to produce all the other programs on the list above, gaining, of course, more layers of abstraction in the process.



Which Programming Language Should You Use?

One of the big choices a computer programmer has to make is what layer of abstraction they want to work at and hence which programming language they'll use.
In rough order of increasing abstraction from the underlying processes are:-

Assembler
C
C++
Pascal/Delphi

C#
Visual Basic
Scripting Languages


Programs made using the lower level languages are more code-efficient, have fewer limitations but take longer to write and, while using a more abstracted language imposes more limitations and can produce bloated code, the programs are quicker to write and, in theory, will contain less errors.

When I programmed for a living I wrote most of my programs in C++ with a few subroutines in assembler to get the last ounce of performance from the video card.
While with video cards I was programming "down to bare metal" (sanding down all the layers of paint that represent abstraction), when writing file operations I would never venture below the illusion that hard drives contain files and folders.
With Windows 2000, Microsoft finally drew the line and said:-
"You must accept the Windows API as the lowest level of abstraction that you can work at for programs to be able to run on a Windows computer."
This is why today we can have 20 different programs all open at the same time on the Desktop and rebooting after a crash is thankfully rare.
Perhaps the Linux community operate at a lower level of abstraction than Windows users and Macintosh users at a somewhat higher level.

Drawing levels of abstraction is a strategy that humans have used, long before computers, to achieve results despite the world's overwhelming complexity.
Computing is a field which needs many layers of abstraction for humans to be able to harness their power.
Computers themselves are also the best tool to bring layers of abstraction to other disciplines and that's why they are indispensable in areas such as business, science, engineering, medicine and education.

In whatever field you are involved in you should find the layer of abstraction that you operate best at.
If things aren't working out then consider shedding or gaining a degree of complexity or try working at multiple levels simultaneously.
It's good to keep remembering what your layers of abstraction are hiding and have a working knowledge of the basic processes that are actually going on.

 

^ Top of Page ^


 
Feedback Form

Type your message below:-

Anonymous feedback is fine. If you'd like a reply then we'll need an email address to send it to.
We'll only use it to reply to your feedback, nothing else!

 

Email Address:
(optional)

We sometimes like to publish visitor feedback, but only if you give us your permission:-

Choose a Screen Name for Published Comments:

 

If you prefer, you can, instead, email your comments to support@arrowmail.co.uk

^ Top of Page ^



 

© 2017 Arrowmail Ltd, a UK-registered company, number 4079706, registered VAT Number GB 895 0987 60
We welcome any comments about this website, good or bad. Send them to webmaster@arrowmail.co.uk