Loading in 5 sec....

Abstraction In Computer Science Timothy Colburn Gary ShutePowerPoint Presentation

Abstraction In Computer Science Timothy Colburn Gary Shute

Download Presentation

Abstraction In Computer Science Timothy Colburn Gary Shute

Loading in 2 Seconds...

- 178 Views
- Uploaded on
- Presentation posted in: General

Download Presentation
## PowerPoint Slideshow about 'Abstraction In Computer Science Timothy Colburn Gary Shute ' - cheche

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Abstraction In Computer ScienceTimothy ColburnGary Shute

- Science and Models
- Computer Science and Mathematics
- Abstraction in Mathematics
- Information Neglect vs. Information Hiding
- Abstraction in Computer Science

Science and Models

- All legitimate sciences build and study mathematical models of their subject matter. For example:
- Graph-theoretic models of molecules
- Models of forest growth, climate change
- Models of demographic trends, etc.

- Their role is one of supporting scientific reasoning in an attempt to discover explanations of observed phenomena.

Science and Models (cont'd)

- Carnap:
- "Formal science [that is, logic and mathematics] ... is an auxiliary component introduced for technical reasons in order to facilitate linguistic transformations in the factual [that is, empirical] sciences."

Science and Models (cont'd)

- The nonmathematical models of empirical science are arrangements of experimental apparatus to test hypotheses
- Example:
- high-energy particle accelerators to model conditions in the early universe to test hypotheses concerning the number of neutrino families there are

Computer Science and Models

- The primary models of computer science are models of computational processes.
- A computational process is an instance of a program execution:
- comprises dynamic electronic events
- described statically in textual artifacts written in programming languages

Programs as Abstractions

- The elements of computational processes that are described in textual programs might be as basic as binary digits (bits) and machine registers, or as familiar as telephone books and shopping carts.
- Textual programs are always abstractions of the electronic events that will ultimately occur.
- One of the most remarkable features of such abstractions is that they not only describe computational processes but also bring them about.

Software's Medium of Description vs. Its Medium of Execution

c = a + b

High-level language program

compiler

Machine language

program

00010001000100010000011110111000

10000001000100010000011110111010

00010001001100010000011110111100

link-loader

physical state

of bistable

memory elements

Formal Languages as Abstract Tools

- The power and utility of tools like compilers, assemblers, and link-loaders mask the fundamental fact that to program a machine is to put its memory into a certain physical state.
- The various levels of formal language that we use today to describe these states are abstract tools for achieving this.

Computer Science and Mathematics

- Computer science, insofar as it is concerned with software, is distinguished from the empirical sciences in that the only models it builds and studies are abstractions.
- Mathematics is also distinguished from the empirical sciences in that the types of models it builds and studies are abstractions.
- Should we be tempted to infer that computer science is a subspecies of mathematics?

Abstraction in Mathematics

- Among philosophers of mathematics there is agreement on the nature of mathematical abstraction being to remove the meaning of specific scientific terms.
- Cohen and Nagel:
- A system is deductive not in virtue of the special meaning of its terms, but in virtue of the universal relations between them. The specific quality of the things which the terms denote do not, as such, play any part in the system.

- Consider the validity of modus ponens.

Abstraction in Mathematics (cont'd)

- It is even common in mathematics to reduce as far as possible the use of abstractions themselves.
- Whitehead and Russell (means "reduced to"):
- real numbers Dedekind cuts (sets) of rational numbers
- rational numbers equivalence classes of pairs of integers
- integers equivalence classes of pairs of counting numbers
- counting numbers sets of sets

Formal Abstraction in Computer Science

- Turing machines are abstractions of computing devices
- A Turing machine is defined as a quadruple (K,,,s) where:
- K is a finite set of states,
- is an alphabet of symbols,
- is a function from K x K, and
- s K is the initial state

- Computation is a mathematical concept, and studying it will naturally involve mathematical methods.

Two Kinds of Mathematical Abstraction

- Mathematical abstraction aids in discovering universal properties or relationships
- for example, deducing the relationships between the lengths of the sides of any right triangle, or
- proving that the halting problem is unsolvable

- Mathematical abstraction is employed when deciding that certain properties are irrelevant when reasoning about the properties of the class of such things as a whole
- for example, the color of a right triangle, or
- the speed of a computing device

Two Kinds of Mathematical Abstraction (cont'd)

- The abstraction of form in favor of content
- The abstraction of certain features in favor of others
- Cohen and Nagel:
- A deductive system is therefore doubly abstract: it abstracts from the specific qualities of a subject matter, and it selects some relations and neglects others

Information Neglect vs. Information Hiding

- Any science succeeds by constructing formal mathematical models of their subject matter that eliminate inessential details--information neglect
- Computer science is unique among all sciences, including mathematics, in the use of a kind of abstraction that computer scientists call information hiding

Abstraction as Information Hiding

- Computer science abstraction tools hide, but do not neglect, details that are essential in a lower-level processing context but inessential in a software design and programming context
- Details can be essential in one context and inessential in another because of abstraction and translation tools that have evolved over the history of software development

Kinds of Abstraction in Computer Science

- Abstraction of processor and memory
- Abstraction of language
- Abstraction of software architecture
- Abstraction of computing resources
- Abstraction of network architecture

Abstraction of Processor and Memory

- Charles Babbage's Analytical Engine design (19th century):
- mill (processor), store (memory), and punched cards (program)

- Had this design been realized in cogs and gears, we would regard it as a stored-program computer, even though it was not electronic
- A stored program computer itself is an abstraction that can be realized by devices in disparate realms

Procedure

Pointer

Abstract data type

Garbage collector

Object

Message

Virtual machine

Abstractions of Processor and Memory (cont'd)- Bit, Byte
- Logic gate
- Register
- Adder, Shifter
- Machine instruction
- Machine data type
- Memory variable

Procedural Abstraction

Consider the algorithm:

for i = 1 to n do

for j = 1 to m do

read(A[i,j])

for j = 1 to m do

for k = 1 to p do

read (B[j,k])

for i = 1 to n do

for k = 1 to p do begin

C[i,k] = 0

for j = 1 to m do

C[i,k] = C[i,k] + A[i,j] * B[j,k]

end

Question: What does this algorithm do?

Procedural Abstraction (cont'd)

Answer: It fills an n x m matrix A and an m x p matrix B

with numbers and multiplies them, putting the result in

an n x p matrix C such that:

m

j = 1

A much easier representation to read:

ReadMatrix(A,n,m)

ReadMatrix(B,m,p)

MultiplyMatrices(A,B,C,n,m,p)

Abstractions of Language

- Language Abstraction: abstraction of the content of computer instructions, allowing descriptions with more expressive power.
- Machine Language: 01000000010101110001000001010010
- Assembly Language: addb r7,sum
- High-Level Language: SQRT(B^2 - 4*A*C)
- Algebraic language:

- Programming paradigms constitute general models of computer problem solving which any one of a number of particular programming languages may attempt to instantiate.

The Imperative Programming Paradigm

- Assembly Languages
- Objects: memory locations and registers
- Actions: loading and storing memory, shifting bits, etc.

- Procedural Languages (C, Pascal, Ada)
- Objects: procedures, matrices, etc.
- Actions: calling a procedure, multiplying matrices, etc.

The Functional Programming Paradigm

- Languages like Lisp, Scheme, and ML:
- Objects: Functions, arguments, and values
- Actions: Function calls

- Insofar as lambda calculus is an appropriate information modeling language for real-world problems, functional programming languages are also appropriate.

The Logic-Oriented Programming Paradigm

- Languages like Prolog:
- Objects: Facts, logic variables, rules, and goals
- Actions: Goal matching, rule firing, backtracking

- Also called a declarative programming paradigm

Artificial Intelligence and Knowledge Representation in Prolog

- A rule: X is a grandparent of Y if there is a Z such that X is a parent of Z and Z is a parent of Y
- A Prolog program:
grandparent(X,Y) :- parent(X,Z), parent(Z,Y).

parent(pat, priscilla).

parent(priscilla, cecilia).

- A Prolog query:
? grandparent(Who, cecilia).

- Prolog answer:
Who = pat

The Object-Oriented Programming Paradigm Prolog

- Languages like C++, Java, Smalltalk, Eiffel:
- Objects: Classes, instances of classes, and class methods
- Actions: Instantiation of classes, calling of methods (sending messages)

- An important aspect of this paradigm is the arrangement of classes of objects in a hierarchy, allowing for the inheritance of both features and operations by one class from another.

OOP Example: Bank Account Hierarchy Prolog

Attributes:

Name

Balance

IntRate

Operations:

Withdraw

Deposit

Compute Interest

Account

Password

Account

Limited

Account

Attributes:

Limit

Operations:

Withdraw

Attributes:

Password

Operations:

Change Password

Abstraction of Computing Resources Prolog

- The logical view of a computing system is that provided to an application programmer of the system's physical state of affairs
- Virtualization is the process involved in converting a physical view to a logical view. Purpose:
- creates a simpler, abstract view for application programmers (information hiding)
- minimizes resource management problems by allowing resources to be shared without conflict

Virtualizable Resources Prolog

- A single physical system can have multiple processes
- Single physical resources that are virtualized for each separate process:
- Displays
- Mice and keyboards
- Disk storage
- Printers
- Networks

Virtualization Mechanisms Prolog

- Mechanisms for giving the appearance of multiple instances of a resource
- Time sharing
- Partitioning

Abstraction of Software Architecture Prolog

- Architectural patterns:
- Multi-Layer
- Client-Server, Peer-to-Peer
- Broker
- Transaction-Processing
- Pipe-and-Filter
- Model-View-Controller

Abstraction of Network Architecture Prolog

- Application layer: includes protocols that support network applications (HTTP, SMTP, FTP)
- Transport layer: transports application layer messages (TCP, UDP)
- Network layer: routes packets from one host to another using IP
- Link layer: provides services to the network layer
- Physical layer: moves individual bits from one node to the next

Conclusions Prolog

- The use of abstraction tools in computer science is unique and sharply distinguishes it from mathematics.
- The evolution of programming languages is tied to ever-increasing abstraction tools and methods, the current embodiment of which only happens to be object-oriented programming.
- In computer science, the more complex the technology, the more removed from technology's complexity its users become.