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:

    Magic is the envelopment and coercion of the objective world by the ego; it is a dynamic subjectivism. Religion is the coercion of the ego by gods and spirits who are objectively conceived beings in control of nature and man.
    Richard Chase (b. 1914)

    When truth is nothing but the truth, it’s unnatural, it’s an abstraction that resembles nothing in the real world. In nature there are always so many other irrelevant things mixed up with the essential truth. That’s why art moves you—precisely because it’s unadulterated with all the irrelevancies of real life.
    Aldous Huxley (1894–1963)