# Gerardo Schneider Department of Informatics University of Oslo December 2008.

## Presentation on theme: "Gerardo Schneider Department of Informatics University of Oslo December 2008."— Presentation transcript:

Gerardo Schneider Department of Informatics University of Oslo December 2008

.net 2Gerardo Schneider JAva Haskell Prolog C Python Lisp fortran cobol pascal basic esterel eiffel Action Script perl Java Script Lustre ml scheme fp Apl php ruby C++ ADA OZ erlang algol modula simula C# vhdl verilog ocaml Java card ALf xsb curry Tcl ecma Script Common lisp curl nemerle rebol aspectj Do you need to know them all? What do you need to know?

3Gerardo Schneider procedure inc(i, j); integer i, j; begin i := i+1; j := j+1 end; k:=1; A[1]:= 2; A[2]=4; inc(k, A[k]); procedure inc( k, A[k] ); integer k, A[k]; begin k := k+1; A[k] := A[k]+1 end; In ALGOL 60 Result: k=2; A[2]=5 Is this what you expected? Probably not! (Call-by-name) What is the resul of the call? Is it i=2 and j=3?

4Gerardo Schneider Write a program to compute a 20 : a 0 = 11/2 a 1 = 61/11 a n+2 = 111– 1130-(3000/ a n ) a n+1 class mya { static double a(int n) { if (n==0) return 11/2.0; if (n==1) return 61/11.0; return 111 - (1130 - 3000/a(n-2))/a(n-1); } public static void main(String[] argv) { for (int i=0;i<=20;i++) System.out.println ("a("+i+") = "+a(i)); } } In JAVA Is this a correct result? NO: The right answer is 20 ! (Precision problem) \$ java mya a(0) = 5.5 a(2) = 5.5901639344262435 a(4) = 5.674648620514802 a(6) = 5.74912092113604 a(8) = 5.81131466923334 a(10) = 5.861078484508624 a(12) = 5.935956716634138 a(14) = 15.413043180845833 a(16) = 97.13715118465481 a(18) = 99.98953968869486 a(20) = 99.99996275956511

.net 5Gerardo Schneider JAva Haskell Prolog C Python Lisp fortran cobol pascal basic esterel eiffel Action Script perl Java Script Lustre ml scheme fp Apl php ruby C++ ADA OZ erlang algol modula simula C# vhdl verilog ocaml Java card ALf xsb curry Tcl ecma Script Common lisp curl nemerle rebol aspectj What about the rest?!

6Gerardo Schneider Functional Program. Object-Oriented Aspect-Oriented Logic Programming Procedural Progam. Parallel Computing Actor-Based Modelling Lang. Reflective Program. Declarative Program. Meta-Programming Constraint Program. Rule-Based Program. Pipeline Program. Dataflow-Based Subject-Oriented Visual Programming It helps! But, what about OZ ? Concurrent, constraint, dataflow, distributed, functional (evaluation: eager, lazy), imperative, logic, object-oriented (class-based), active and passive objects

Syntax Semantics Taxonomy (Pragmatics) Paradigms Principles 7Gerardo Schneider

Sequential vs Concurrent Shared Memory vs Message Passing Synchronous vs Asynchronous Static vs Dynamic Scope Value-Passing (by value, by reference, by name,...) Lazy vs Eager Evaluation Untyped vs Typed 8Gerardo Schneider Passive vs Active Objects Simple vs Multiple Inheritance Lower vs Higher-Order Functions Recursion vs Iteration Unification / Resolution Pattern Matching Exceptions, Tail recursion, backtracking, heap,...

9Gerardo Schneider A program with sensitive data (Avoid indirect information flow) A program running concurrently in an open system with shared variables (Avoid side effects) A program to run on a small device -smart card (Guarantee bound on resources) A program with hard real- time constraints (Avoid problems with response time) Knowing the basic principles and the application domain will help you to develop better and more accurate programs

 Good to know the syntax well enough  Good to be a ”good” practioner  Good if you know how to test programs  Good if you can be a good hacker  Good if you can understand your code  Good to learn many programming languages  Better if you also know the semantics  Better if you also know the theory  Better if you also apply formal validation tech.  Better if you also have a good methodology  Better if somebody else also understands it  Better if you also know the principles 10Gerardo Schneider

Download ppt "Gerardo Schneider Department of Informatics University of Oslo December 2008."

Similar presentations