Jump to content

Theory of computationː Abstraction

From Wikibooks, open books for an open world

PAPER 1 - ⇑ Theory of computation ⇑

← Problem solving Abstraction Decomposition →


Introduction

[edit | edit source]
Concept of Abstraction

Abstraction

[edit | edit source]
  • representational abstraction is a representation arrived at by removing unnecessary details
  • abstraction by generalisation or categorisation is a grouping by common characteristics to arrive at a hierarchical relationship of the 'is a kind of' type.

Information Hiding

[edit | edit source]
  • The process of hiding all details of an object that do not contribute to its essential characteristics.

Procedural Abstraction

[edit | edit source]
  • The result of abstracting away the actual values used in any particular computation is a computational pattern or computational method – a procedure.
Exercise: Example of a Procedural Abstraction


Algorithm to calculate square of a number

  • Input number
  • Print sqr(5)

Procedure sqr(int: number)
Calculate number ** 2
End Procedure

Text in bold is the result of a procedural abstraction which is the procedure itself without the actual value of number in this case.

Functional Abstraction

[edit | edit source]
  • The result of a procedural abstraction is a procedure, not a function. To get a function requires yet another abstraction, which disregards the particular computation method and this is a functional abstraction.

Data Abstraction

[edit | edit source]
  • Data abstraction is a methodology that enables us to isolate how a compound data object is used from the details of how it is constructed. For example, a stack could be implemented as an array and a pointer for top of stack.

Problem Abstraction/Reduction

[edit | edit source]
  • Details are removed until the problem is represented in a way that is possible to solve because the problem reduces to one that has already been solved.
Exercise: Abstraction
What is abstraction?

Answer:

This is the process of creating a generic model or template by grouping common characteristics and removing unnecessary details.
Exercise: Information Hiding
What is Information Hiding?

Answer:

This is the process of hiding all details of an object that do not contribute to its essential characteristics.