Some Programming Paradigms 5/14/2019
Imperative Programming E.g., FORTRAN, C,… Focus on the algorithms. Data in separate structures. Algorithm abstraction: Give name to a sequence of instructions (stepwise refinement). Structured programming (e.g., avoid “spaghetti programming” by not using the goto-statement). 5/14/2019
“Data Modelling” Focus on data an the static relationships Data abstractions: Give name to a group of data (e.g., named records) 5/14/2019
Object-oriented programming Data and behaviour is put together E.g., Smalltalk, C++, Java In a sense it combines the two presiding paradigms! 5/14/2019
The First Object-oriented Language: Simula Introduced in 1966 (or earlier). Created by Ole-Johan Dahl and Kristen Nygaard. A language for simulation but became a general purpose programming language. Allan Key: “Simula is a major improvement of most of its sucessors” 5/14/2019
From Wikipedia, the free encyclopedia: Programming paradigms Agent-oriented Automata-based Component-based Flow-based Pipelined Concatenative Concurrent computing Relativistic programming Data-driven Declarative (contrast: Imperative) Constraint Functional Dataflow Cell-oriented (spreadsheets) Reactive Logic Abductive logic Answer set Constraint logic Functional logic Inductive logic Uncertain inference Markov logic Probabilistic logic Event-driven Service-oriented Time-driven Expression-oriented Feature-oriented Function-level (contrast: Value-level) Generic Imperative (contrast: Declarative) Procedural Language-oriented Discipline-specific Domain-specific Grammar-oriented Dialecting Intentional Metaprogramming Automatic Reflective Attribute-oriented Template Policy-based Non-structured (contrast: Structured) Array (contrast: Scalar) Iterative Nondeterministic Parallel computing Process-oriented Programming in the large/small Semantic Structured (contrast: Non-structured) Modular (contrast: Monolithic) Object-oriented By separation of concerns: Aspect-oriented Role-oriented Subject-oriented Class-based Prototype-based Recursive Value-level (contrast: Function-level) From Wikipedia: SQL often referred to as Structured Query Language, is a database computer declarative language designed for managing data in relational database management systems (RDBMS), and originally based upon relational algebra and tuple relational calculus. Multi-paradigm (e.g., SQL, C++, Scheme,…). Functional programming is a subset of declarative programming. Programs written using this paradigm use functions, blocks of code intended to behave like mathematical functions. Functional languages discourage changes in the value of variables through assignment, making a great deal of use of recursion instead. The logic programming paradigm views computation as automated reasoning over a corpus of knowledge. Facts about the problem domain are expressed as logic formulae, and programs are executed by applying inference rules over them until an answer to the problem is found, or the collection of formulae is proved inconsistent. Constraint programming (e.g., Prolog III) is a programming paradigm wherein relations between variables are stated in the form of constraints. 5/14/2019
All types of modelling involves some “sort of objects” E.g., in functional programming you have function and function activations (the call of a function). It seems that understanding the world as composed of objects is unavoidable… 5/14/2019
The Object-oriented Approach Tries To Mimic The Way We Think. (From Wikipedia, the free encyclopedia) “Accidental complexity is complexity that arises in computer programs or their development process (computer programming) which is non-essential to the problem to be solved. While essential complexity is inherent and unavoidable, accidental complexity is caused by the approach chosen to solve the problem.” The oo-approach tries to minimise accidental complexity. 5/14/2019
Structure – Behaviour The Yin and Yang of Programming Some UML Structure: :married Jane:Person Jams:Person Jane:Person :owns Some behaviour :owns someWreck:Car someWreck:Car Underling functional Structure of expression (+ (+ 3 4) 5): + Graph Reduction Graph Reduction + 12 + 5 7 5 3 4 5/14/2019