Abstraction

abstraction - a concept or idea not associated with any specific instance (Thefreedictionary.com)

Computing is a whole world of abstractions.

"...all programming relies on an ability to abstract verbs as functions, nouns as data structures, and either as processes." (Wikipedia)

"Abstraction: representation that is arrived at by removing unnecessary details" (Bond & Langfield, page 7)

Wikipedia: Abstraction in general

Wikipedia: Abstraction in Computer Science

The Wikipedia article covers some of the philosophical issues surrounding the issue of abstractness. Humans use words and ideas all the time that display a mixture of the abstract and the concrete. Computer science employs a range of tools to help with the process of making abstract ideas concrete and realisable as programs. Two basic principles of computing are abstraction and automation. Abstraction involves the extraction of detail from a situation until its structure or essence can be formalised in a model; automation involves making a working version of the model so that it can be put to work in the original scenario.

One example might be a railway system: in the days before computers the exact position of trains was not known and signalling systems were mechanical: accidents were common and a system as complex as a city underground network were unthinkable. In the modern era sensors in the track provide detailed information on the location of every train and signals can respond electronically to these inputs: still there are accidents as many tracks have old technology and new systems are expensive to introduce and may contain flaws or bugs.

To produce a control system for a network such as the London underground an engineer would need to make an abstraction of the track, though not one as simple as the classic London Underground Map, which was meant for passengers rather than engineers. The maps on this page show degrees of abstraction with the 1908 map showing the position of the tracks and the Harry Beck design showing a much more abstract or generalised map.

An engineer would start by looking at the complex reality of the existing network (so much easier to design from scratch, as with the London Docklands Railway). The complex reality would be reduced to a schematic diagram that provided the appropriate level of detail. The system of nodes (stations) and links (track between stations) might then be converted to a graph and thence to a data structure that can be held in a computer. The actual representation of the network might be in the form of an array or nodes with pointers; the network is quite complex as some stations have one link (e.g. Uxbridge, Chesham), many have two (the next stations in either direction) while others have multiple links through other lines (e.g. Baker Street). The representation so far might be suitable for measuring distances, connectivity and costs but it is too general to be useful in designing a control system as this requires far more detail on the way sections of track come together and how trains might be heading towards a common section of track or sharing it as they pass through a station.

Reading the Wikipedia article on abstraction should also make you think of Object Oriented Programming - talk of Elsie is-a cat and instantiation as the creation of actual objects as real examples of an abstract concept could be taken from an OOP text book.

You might think of a computer as a piece of hardware and a concrete realisation of the abstract notion of a computer. Computers implement abstract models of computation such as the Turing machine and the Von Neumann machine.

"A typical abstract machine consists of a definition in terms of input, output, and the set of allowable operations used to turn the former into the latter. The best-known example is the Turing machine." (Wikipedia)

An abstract machine might also be a virtual machine.

A programming language is itself an expression of abstraction. An example of abstraction at work is the development of programming languages from machine code to assembler to high level languages. Computer scientists find new ways to abstract the complexity of machine operations into more compact, logical and accessible statements; thus a branch in assembler, dependent on the contents of a memory location and a comparison operation, becomes an if statement or a while loop. Always there is a complex, messy world beneath the language and an abstract, elegant, succinct system of words and logic embodied in it.

Many languages allow a programmer to create new abstractions such as modules, subroutines, functions and procedures. OOP systems allow the programmer to define a parent object with certain properties and descendant objects that inherit these properties and add new ones and modify the inherited ones; the word abstract is used to define a method in an object that is explicitly defined in child objects that inherit from the parent.

Specification languages provide a means of analysing and describing a software system in an abstract manner e.g. VDM. These languages typically assume that programs are modelled as algebraic structures that include a collection of sets of data values together with functions over those sets. "This level of abstraction is commensurate with the view that the correctness of the input/output behaviour of a program takes precedence over all its other properties." (Wikipedia)

Control Abstraction

High level programming languages abstract the complexities of low-level machine operation (registers, memory, instructions, operands) and allow human-level instructions such as "a := b * c;" . The abstraction includes all of the low-level operations necessary to implement this simple-looking expression and the conversions to and from binary. Without this control abstraction a programmer would need to operate like a 1940s-style computer scientist, programming every small step that the computer required in machine code to enter data, move data around the machine and produce outputs.

Structured Programming

This involves breaking long, complex tasks into smaller sub-programs with clear flow-control and interfaces between components. See here. A typical way of developing a console (CLI) application would be to provide a menu and numbered options; choosing an option would call a particular function or procedure, which might be built from pre-existing libraries .

Data Abstraction

Data abstraction separates the abstract properties of a data type from the details of its actual implementation. The abstract properties are those that are visible to the client code that uses the data type (the interface to the data type) while the concrete implementation is kept private. The underlying implementation might change with no effect on code since the behaviour of the data types is abstract.

Abstract data types (ADTs) are those that are not implemented in the host programming language. Pascal provides sets, records and arrays and pointer types but it does not provide stacks, queues, linked lists or trees: the programmer must design and implement these for himself. It does not matter to a client program how a particular data type is implemented.

Abstraction in Object Oriented Programming

In OOP objects are defined that represent abstract actors that can perform work, report on and change their state and communicate with other objects in the system. Encapsulation refers to the hiding of details and extending the concept of data type to include methods (hence the description of classes as 'records on steroids').

Abstraction in Course Work

In your course work you will identify a problem and then perform a number of types of abstraction on it: this is what you do in the Analysis and Design sections. You will anlayse the problem until you understand it sufficiently to produce a model of it, either a 'conceptual data model' consisting of entities, attributes and relationships (the EAR or ER model) or some other model such as a graph that abstracts from the complex reality to a simplified version that can be implemented in a programming language.

You will produce diagrams such as data flow diagrams and system flow charts that are abstractions of the blocks of code that you will implement later. You will produce a break down of the code modules that your program will use and the interface between them. You will produce a test plan that lists the parts of the code that you will test: this is done before you start coding so that you know exactly what you are working towards; it is another example of abstraction as you are defining a test on something that does not yet exist.

You will also define data items such as arrays, records and linked lists that capture the structure of the real-world data. These will be used to create abstract data types that did not exist in the language until you defined them. If you use OOP you will perform a number of abstractions as you define an object hierarchy and polymorphic methods.

Generalisation

Trace levels of abstraction from 'animal' to my dog Archie.

Pigeonhole Principle

Identify a principle that is shared between different problems. e.g. pigeonhole principle: 6 into 5 won't go. There must be 2 people in London with the same number of hairs on their head - ? Any more examples?

Data Representation

Use a data structure to represent reality. Convert reality to an abstraction. Principles in common: mobile phone masts and map colouring (four colour theorem). Take a map such as the US and represent it as a graph.