Presentation is loading. Please wait.

Presentation is loading. Please wait.

SWE 4743 Abstraction Richard Gesick. CSE 1301 2-13 Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can.

Similar presentations


Presentation on theme: "SWE 4743 Abstraction Richard Gesick. CSE 1301 2-13 Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can."— Presentation transcript:

1 SWE 4743 Abstraction Richard Gesick

2 CSE 1301 2-13 Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can focus on a few concepts at a time

3 CSE 1301 3-13 The concept originated by analogy with abstraction in mathematics in both computing and in mathematics, numbers are concepts in the programming languages, as found in mathematics. Implementation details depend on the hardware and software, but this is not a restriction

4 CSE 1301 4-13 Data and Control Abstraction Control abstraction is the abstraction of actions –Control abstraction involves the use of subprograms and related concepts control flows data abstraction is that of data structures –allows handling data bits in meaningful ways. For example, it is the basic motivation behind datatype

5 CSE 1301 5-13 objects an attempt to combine abstractions of data and code.

6 CSE 1301 6-13 Abstraction in programming languages Different programming languages provide different types of abstraction –In object-oriented programming languages the concept of abstraction has itself become a declarative statement - using the keywords virtual or abstract and interface. After such a declaration, it is the responsibility of the programmer to implement a class to instantiate the object of the declaration.

7 CSE 1301 7-13 Abstraction in programming languages Functional programming languages commonly exhibit abstractions related to functions –lambda abstractions (making a term into a function of some variable), higher-order functions (parameters are functions), bracket abstraction (making a term into a function of a variable).

8 CSE 1301 8-13 Specification languages Specification languages generally rely on abstractions –specifications are typically defined earlier in a project, (and at a more abstract level) than an eventual implementation. The UML specification language, allows the definition of abstract classes, –remain abstract during the architecture and specification phase of the project.

9 CSE 1301 9-13 Control Abstraction 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.

10 CSE 1301 10-13 a = (1 + 2) * 5 Without control abstraction, –a programmer would need to specify all the register/binary-level steps each time he/she 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: –it forces the programmer to constantly repeat fairly common tasks every time a similar operation is needed –it forces the programmer to program for the particular hardware and instruction set

11 CSE 1301 11-13 Data Abstraction Data abstraction enforces a clear separation between the abstract properties of a data type and the concrete details of its implementation. The abstract properties are those that are visible to client code that makes use of the data type—the interface to the data type— while the concrete implementation is kept entirely private

12 CSE 1301 12-13 Data Abstraction one could define an abstract data type called lookup table which uniquely associates keys with values, and in which values may be retrieved by specifying their corresponding keys. –Such a lookup table may be implemented as a hash table, a binary search tree, or even a simple linear list of (key:value) pairs. the abstract properties of the type are the same in each case

13 CSE 1301 13-13 In object-oriented programming abstraction involves the facility to define objects that represent abstract "actors“ – that can perform work, report on and change their state, and "communicate" with other objects in the system


Download ppt "SWE 4743 Abstraction Richard Gesick. CSE 1301 2-13 Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can."

Similar presentations


Ads by Google