Presentation is loading. Please wait.

Presentation is loading. Please wait.

Abstraction In Computer Science Timothy Colburn Gary Shute ● Science and Models ● Computer Science and Mathematics ● Abstraction in Mathematics ● Information.

Similar presentations


Presentation on theme: "Abstraction In Computer Science Timothy Colburn Gary Shute ● Science and Models ● Computer Science and Mathematics ● Abstraction in Mathematics ● Information."— Presentation transcript:

1 Abstraction In Computer Science Timothy Colburn Gary Shute ● Science and Models ● Computer Science and Mathematics ● Abstraction in Mathematics ● Information Neglect vs. Information Hiding ● Abstraction in Computer Science

2 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.

3 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."

4 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

5 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

6 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.

7 Software's Medium of Description vs. Its Medium of Execution c = a + b High-level language program compiler 00010001000100010000011110111000 10000001000100010000011110111010 00010001001100010000011110111100 Machine language program link-loader physical state of bistable memory elements

8 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.

9 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?

10 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.

11 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

12 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.

13 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

14 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

15 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

16 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

17 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

18 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

19 Abstractions of Processor and Memory (cont'd) ● Bit, Byte ● Logic gate ● Register ● Adder, Shifter ● Machine instruction ● Machine data type ● Memory variable ● Subroutine, Function ● Procedure ● Pointer ● Abstract data type ● Garbage collector ● Object ● Message ● Virtual machine

20 Procedural Abstraction 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 Consider the algorithm: Question: What does this algorithm do?

21 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: j = 1 m A much easier representation to read: ReadMatrix(A,n,m) ReadMatrix(B,m,p) MultiplyMatrices(A,B,C,n,m,p)

22 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.

23 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.

24 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.

25 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

26 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

27 The Object-Oriented Programming Paradigm ● 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.

28 OOP Example: Bank Account Hierarchy Account Password Account Limited Account Attributes: Name Balance IntRate Operations: Withdraw Deposit Compute Interest Attributes: Password Operations: Change Password Attributes: Limit Operations: Withdraw

29 Abstraction of Computing Resources ● 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

30 Virtualizable Resources ● 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

31 Virtualization Mechanisms ● Mechanisms for giving the appearance of multiple instances of a resource – Time sharing – Partitioning

32 Abstraction of Software Architecture ● Architectural patterns: – Multi-Layer – Client-Server, Peer-to-Peer – Broker – Transaction-Processing – Pipe-and-Filter – Model-View-Controller

33 Abstraction of Network Architecture ● 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

34 Conclusions ● 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.


Download ppt "Abstraction In Computer Science Timothy Colburn Gary Shute ● Science and Models ● Computer Science and Mathematics ● Abstraction in Mathematics ● Information."

Similar presentations


Ads by Google