Abstraction

From CS 61A Wiki
Revision as of 20:36, 4 June 2014 by Axis (Talk | contribs)


Jump to: navigation, search

Abstraction is a technique for managing complexity. It is based on separation of concerns: organizing programs so that you can work on one thing at a time in isolation. Abstraction hides details that can make a program too complex to understand.

Data abstraction

Data abstraction refers to inventing new data types and separating functionality from representation.

Process abstraction

Process abstraction refers to higher-order functions expressing computational processes in a compact form.

Examples

Assignment

Assignment binds a name to a value, abstracting away the complexity of the value. Thereafter, the programmer can use the name.

Function

A function encapsulates a behavior, abstracting away the complexity of its implementation. The programmer can treat the function as a "black box" that spits out a correct result given some inputs.

Sources