Abstraction (computer Science) - Control Abstraction

Control Abstraction

Programming languages offer control abstraction as one of the main purposes of their use. Computer machines understand operations at the very low level such as moving some bits from one location of the memory to another location and producing the sum of two sequences of bits. Programming languages allow this to be done in the higher level. For example, consider this statement written in a Pascal-like fashion:

a := (1 + 2) * 5

To a human, this seems a fairly simple and obvious calculation ("one plus two is three, times five is fifteen"). However, the low-level steps necessary to carry out this evaluation, and return the value "15", and then assign that value to the variable "a", are actually quite subtle and complex. The values need to be converted to binary representation (often a much more complicated task than one would think) and the calculations decomposed (by the compiler or interpreter) into assembly instructions (again, which are much less intuitive to the programmer: operations such as shifting a binary register left, or adding the binary complement of the contents of one register to another, are simply not how humans think about the abstract arithmetical operations of addition or multiplication). Finally, assigning the resulting value of "15" to the variable labeled "a", so that "a" can be used later, involves additional 'behind-the-scenes' steps of looking up a variable's label and the resultant location in physical or virtual memory, storing the binary representation of "15" to that memory location, etc.

Without control abstraction, a programmer would need to specify all the register/binary-level steps each time he simply wanted to add or multiply a couple of numbers and assign the result to a variable. Such duplication of effort has two serious negative consequences:

  1. it forces the programmer to constantly repeat fairly common tasks every time a similar operation is needed
  2. it forces the programmer to program for the particular hardware and instruction set

Read more about this topic:  Abstraction (computer Science)

Famous quotes containing the words control and/or abstraction:

    A “super person” is one who expects to manage a career, home, and family with complete ease, expecting to maintain a perfect job, a perfect marriage, a perfect house, and perfect control of the children.
    Joyce Portner (late 20th century)

    By “object” is meant some element in the complex whole that is defined in abstraction from the whole of which it is a distinction.
    John Dewey (1859–1952)