Содержание
- 2. Programming Paradigm A way of conceptualizing what it means to perform computation and how tasks to
- 3. cs784(Prasad) L5Pdm Imperative vs Non-Imperative Functional/Logic programs specify WHAT is to be computed abstractly, leaving the
- 4. cs784(Prasad) L5Pdm Illustrative Example Expression (to be computed) : a + b + c Recipe for
- 5. cs784(Prasad) L5Pdm Imperative vs Non-Imperative Functional/Logic style clearly separates WHAT aspects of a program (programmers’ responsibility)
- 6. cs784(Prasad) L5Pdm Procedural vs Functional Program: a sequence of instructions for a von Neumann m/c. Computation
- 7. cs784(Prasad) L5Pdm Functional Style : Illustration Definition : Equations sum(0) = 0 sum(n) = n +
- 8. cs784(Prasad) L5Pdm Paradigm vs Language Imperative Style i := 0; sum := 0; while (i i
- 9. cs784(Prasad) L5Pdm Role of Variables Imperative (read/write) i 0 1 2 3 ... sum 0 1
- 10. cs784(Prasad) L5Pdm Bridging the Gap Tail recursive programs can be auomatically optimized for space by translating
- 11. cs784(Prasad) L5Pdm Analogy: Styles vs Formalisms Iteration Tail-Recursion General Recursion Regular Expression Regular Grammar Context-free Grammar
- 12. cs784(Prasad) L5Pdm Logic Programming Paradigm Integrates Data and Control Structures edge(a,b). edge(a,c). edge(c,a). path(X,X). path(X,Y) :-
- 13. cs784(Prasad) L5Pdm Declarative Programming A logic program defines a set of relations. This “knowledge” can be
- 14. cs784(Prasad) L5Pdm Append in Prolog append([], L, L). append([ H | T ], L, [ H
- 15. cs784(Prasad) L5Pdm Different Kinds of Queries Verification sig: list x list x list append([1], [2,3], [1,2,3]).
- 16. cs784(Prasad) L5Pdm More Queries Constraint solving sig: list x list -> list append( R, [2,3], [1,2,3]).
- 17. cs774 (Prasad) L1LP Trading expressiveness for efficiency : Executable specification
- 18. cs784(Prasad) L5Pdm Object-Oriented Style Programming with Abstract Data Types ADTs specify/describe behaviors. Basic Program Unit: Class
- 19. cs784(Prasad) L5Pdm Procedural vs Object-Oriented Emphasis on procedural abstraction. Top-down design; Step-wise refinement. Suited for programming
- 20. cs784(Prasad) L5Pdm Integrating Heterogeneous Data In C, Pascal, etc., use Union Type / Switch Statement Variant
- 21. cs784(Prasad) L5Pdm Comparison : Figures example Data Square side Circle radius Operation (area) Square side *
- 22. cs784(Prasad) L5Pdm Adding a new operation Data ... Operation (area) Operation (perimeter) Square 4 * side
- 23. cs784(Prasad) L5Pdm Adding a new data representation Data ... rectangle length width Operation (area) ... rectangle
- 24. cs784(Prasad) L5Pdm Procedural vs Object-Oriented New operations cause additive changes in procedural style, but require modifications
- 25. cs784(Prasad) L5Pdm Object-Oriented Concepts Data Abstraction (specifies behavior) Encapsulation (controls visibility of names) Polymorphism (accommodates various
- 26. cs784(Prasad) L5Pdm Example : Role of interface in decoupling Client Determine the number of elements in
- 27. cs784(Prasad) L5Pdm Client in Scheme (define (size C) (cond ( (vector? C) (vector-length C) ) (
- 29. Скачать презентацию