🗊 Презентация Programming paradigms

Нажмите для полного просмотра!
Programming paradigms, слайд №1 Programming paradigms, слайд №2 Programming paradigms, слайд №3 Programming paradigms, слайд №4 Programming paradigms, слайд №5 Programming paradigms, слайд №6 Programming paradigms, слайд №7 Programming paradigms, слайд №8 Programming paradigms, слайд №9 Programming paradigms, слайд №10 Programming paradigms, слайд №11 Programming paradigms, слайд №12 Programming paradigms, слайд №13 Programming paradigms, слайд №14 Programming paradigms, слайд №15 Programming paradigms, слайд №16 Programming paradigms, слайд №17 Programming paradigms, слайд №18 Programming paradigms, слайд №19 Programming paradigms, слайд №20 Programming paradigms, слайд №21 Programming paradigms, слайд №22 Programming paradigms, слайд №23 Programming paradigms, слайд №24 Programming paradigms, слайд №25 Programming paradigms, слайд №26 Programming paradigms, слайд №27 Programming paradigms, слайд №28 Programming paradigms, слайд №29 Programming paradigms, слайд №30

Вы можете ознакомиться и скачать презентацию на тему Programming paradigms. Доклад-сообщение содержит 30 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


Programming Paradigms Procedural Functional Logic Object-Oriented
Описание слайда:
Programming Paradigms Procedural Functional Logic Object-Oriented

Слайд 2


Specifying the WHAT Describe the Inputs Specific values Properties Describe the Outputs (as above) Describe the Relationships Between I x O As a...
Описание слайда:
Specifying the WHAT Describe the Inputs Specific values Properties Describe the Outputs (as above) Describe the Relationships Between I x O As a possibly infinite table Equations and other predicates between input and output expressions For a given input, output may not be unique

Слайд 3


Specifying the HOW Describe the Inputs Specific values Properties Describe HOW the Outputs are produced Models of existing computers Program State...
Описание слайда:
Specifying the HOW Describe the Inputs Specific values Properties Describe HOW the Outputs are produced Models of existing computers Program State Control Flow A Few Abstractions Block Structure Recursion via a Stack

Слайд 4


Procedural programming Describes the details of HOW the results are to be obtained, in terms of the underlying machine model. Describes computation...
Описание слайда:
Procedural programming Describes the details of HOW the results are to be obtained, in terms of the underlying machine model. Describes computation in terms of Statements that change a program state Explicit control flow Synonyms Imperative programming Operational Fortran, C, … Abstractions of typical machines Control Flow Encapsulation Control Structures Procedures No return values Functions Return one or more values Recursion via stack

Слайд 5


Procedural Programming: State Program State Collection of Variables and their values Contents of variables change Expressions Not expected to change...
Описание слайда:
Procedural Programming: State Program State Collection of Variables and their values Contents of variables change Expressions Not expected to change Program State Assignment Statements Other Statements Side Effects

Слайд 6


C, C++, C#, Java Abstractions of typical machines Control Flow Encapsulation Control Structures Procedures No return values Functions Return one or...
Описание слайда:
C, C++, C#, Java Abstractions of typical machines Control Flow Encapsulation Control Structures Procedures No return values Functions Return one or more values Recursion via stack Better Data Type support

Слайд 7


Illustrative Example Expression (to be computed) : a + b + c Recipe for Computation Account for machine limitations Intermediate Location T := a + b;...
Описание слайда:
Illustrative Example Expression (to be computed) : a + b + c Recipe for Computation Account for machine limitations Intermediate Location T := a + b; T := T + c; Accumulator Machine Load a; Add b; Add c Stack Machine Push a; Push b; Add; Push c; Add

Слайд 8


Declarative Programming Specifies WHAT is to be computed abstractly Expresses the logic of a computation without describing its control flow...
Описание слайда:
Declarative Programming Specifies WHAT is to be computed abstractly Expresses the logic of a computation without describing its control flow Declarative languages include logic programming, and functional programming. often defined as any style of programming that is not imperative.

Слайд 9


Imperative vs Non-Imperative Functional/Logic style clearly separates WHAT aspects of a program (programmers’ responsibility) from the HOW aspects...
Описание слайда:
Imperative vs Non-Imperative Functional/Logic style clearly separates WHAT aspects of a program (programmers’ responsibility) from the HOW aspects (implementation decisions). An Imperative program contains both the specification and the implementation details, inseparably inter-twined.

Слайд 10


Procedural vs Functional Program: a sequence of instructions for a von Neumann m/c. Computation by instruction execution. Iteration. Modifiable or...
Описание слайда:
Procedural vs Functional Program: a sequence of instructions for a von Neumann m/c. Computation by instruction execution. Iteration. Modifiable or updatable variables..

Слайд 11


Functional Style : Illustration Definition: Equations sumto(0) = 0 sumto(n) = n + sumto(n-1) Computation: Substitution and Replacement sumto(2) = 2 +...
Описание слайда:
Functional Style : Illustration Definition: Equations sumto(0) = 0 sumto(n) = n + sumto(n-1) Computation: Substitution and Replacement sumto(2) = 2 + sumto (2-1) = 2 + sumto(1) = 2 + 1 + sumto(1-1) = 2 + 1 + sumto(0) = 2 + 1 + 0 = … = 3

Слайд 12


Paradigm vs Language Imperative Style
Описание слайда:
Paradigm vs Language Imperative Style

Слайд 13


Bridging the Gap Imperative is not always faster, or more memory efficient than functional. E.g., tail recursive programs can be automatically...
Описание слайда:
Bridging the Gap Imperative is not always faster, or more memory efficient than functional. E.g., tail recursive programs can be automatically translated into equivalent while-loops. func xyz(n : int, r : int) : int; if n = 0 then r else xyz(n-1, n+r) fi endfunc

Слайд 14


Analogy: Styles vs Formalisms Iteration Tail-Recursion General Recursion
Описание слайда:
Analogy: Styles vs Formalisms Iteration Tail-Recursion General Recursion

Слайд 15


Logic Programming Paradigm edge(a,b). edge(a,c). edge(c,a). path(X,X). path(X,Y) :- edge(X,Y). path(X,Y) :- edge(X,Z), path(Z,Y).
Описание слайда:
Logic Programming Paradigm edge(a,b). edge(a,c). edge(c,a). path(X,X). path(X,Y) :- edge(X,Y). path(X,Y) :- edge(X,Z), path(Z,Y).

Слайд 16


Logic Programming A logic program defines a set of relations. This “knowledge” can be used in various ways by the interpreter to solve different...
Описание слайда:
Logic Programming A logic program defines a set of relations. This “knowledge” can be used in various ways by the interpreter to solve different “queries”. In contrast, the programs in other languages Make explicit HOW the “declarative knowledge” is used to solve the query.

Слайд 17


Append in Prolog append([], L, L). append([ H | T ], X, [ H | Y ]) :- append(T, X, Y). True statements about append relation. Uses pattern matching....
Описание слайда:
Append in Prolog append([], L, L). append([ H | T ], X, [ H | Y ]) :- append(T, X, Y). True statements about append relation. Uses pattern matching. “[]” and “|” stand for empty list and cons operation.

Слайд 18


Different Kinds of Queries Verification append: list x list x list append([1], [2,3], [1,2,3]). Concatenation append: list x list -> list append([1],...
Описание слайда:
Different Kinds of Queries Verification append: list x list x list append([1], [2,3], [1,2,3]). Concatenation append: list x list -> list append([1], [2,3], R).

Слайд 19


More Queries Constraint solving append: list x list -> list append( R, [2,3], [1,2,3]). append: list -> list x list append(A, B, [1,2,3]). Generation...
Описание слайда:
More Queries Constraint solving append: list x list -> list append( R, [2,3], [1,2,3]). append: list -> list x list append(A, B, [1,2,3]). Generation append: -> list x list x list append(X, Y, Z).

Слайд 20


Object-Oriented Style Programming with Abstract Data Types ADTs specify/describe behaviors. Basic Program Unit: Class Implementation of an ADT....
Описание слайда:
Object-Oriented Style Programming with Abstract Data Types ADTs specify/describe behaviors. Basic Program Unit: Class Implementation of an ADT. Abstraction enforced by encapsulation.. Basic Run-time Unit: Object Instance of a class. Has an associated state.

Слайд 21


Procedural vs Object-Oriented Emphasis on procedural abstraction. Top-down design; Step-wise refinement. Suited for programming in the small.
Описание слайда:
Procedural vs Object-Oriented Emphasis on procedural abstraction. Top-down design; Step-wise refinement. Suited for programming in the small.

Слайд 22


Integrating Heterogeneous Data In C, Pascal, etc., use Union Type / Switch Statement Variant Record Type / Case Statement In C++, Java, Eiffel, etc.,...
Описание слайда:
Integrating Heterogeneous Data In C, Pascal, etc., use Union Type / Switch Statement Variant Record Type / Case Statement In C++, Java, Eiffel, etc., use Abstract Classes / Virtual Functions Interfaces and Classes / Dynamic Binding

Слайд 23


Comparison : Figures example Data Square side Circle radius Operation (area) Square side * side Circle PI * radius * radius
Описание слайда:
Comparison : Figures example Data Square side Circle radius Operation (area) Square side * side Circle PI * radius * radius

Слайд 24


Adding a new operation Data ... Operation (area) Operation (perimeter) Square 4 * side Circle 2 * PI * radius
Описание слайда:
Adding a new operation Data ... Operation (area) Operation (perimeter) Square 4 * side Circle 2 * PI * radius

Слайд 25


Adding a new data representation
Описание слайда:
Adding a new data representation

Слайд 26


Procedural vs Object-Oriented New operations cause additive changes in procedural style, but require modifications to all existing “class modules” in...
Описание слайда:
Procedural vs Object-Oriented New operations cause additive changes in procedural style, but require modifications to all existing “class modules” in object-oriented style. New data representations cause additive changes in object-oriented style, but require modifications to all “procedure modules”.

Слайд 27


Object-Oriented Concepts Data Abstraction (specifies behavior) Encapsulation (controls visibility of names) Polymorphism (accommodates various...
Описание слайда:
Object-Oriented Concepts Data Abstraction (specifies behavior) Encapsulation (controls visibility of names) Polymorphism (accommodates various implementations) Inheritance (facilitates code reuse) Modularity (relates to unit of compilation)

Слайд 28


Example : Role of interface in decoupling Client Determine the number of elements in a collection. Suppliers Collections : Vector, String, List, Set,...
Описание слайда:
Example : Role of interface in decoupling Client Determine the number of elements in a collection. Suppliers Collections : Vector, String, List, Set, Array, etc Procedural Style A client is responsible for invoking appropriate supplier function for determining the size. OOP Style Suppliers are responsible for conforming to the standard interface required for exporting the size functionality to a client.

Слайд 29


Client in Scheme (define (size C) (cond ( (vector? C) (vector-length C) ) ( (pair? C) (length C) ) ( (string? C) (string-length C) ) ( else “size not...
Описание слайда:
Client in Scheme (define (size C) (cond ( (vector? C) (vector-length C) ) ( (pair? C) (length C) ) ( (string? C) (string-length C) ) ( else “size not supported”) ))) (size (vector 1 2 (+ 1 2))) (size ‘(one “two” 3))

Слайд 30


Suppliers and Client in Java Interface Collection {int size(); } class myVector extends Vector implements Collection { } class myString extends...
Описание слайда:
Suppliers and Client in Java Interface Collection {int size(); } class myVector extends Vector implements Collection { } class myString extends String implements Collection { public int size() { return length();} } class myArray implements Collection { int[] array; public int size() {return array.length;} } Collection c = new myVector(); c.size();



Похожие презентации
Mypresentation.ru
Загрузить презентацию