1 / 18

The Evolution of Programming Languages

The Evolution of Programming Languages. CS 351. Ij. 1. Customized Digital Computer . Oj. Task j. Task k. Ik. Ok. Rig different circuit for each task . 2. Stored Program Computing.

Jims
Download Presentation

The Evolution of Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Evolution of Programming Languages CS 351 Mark Hennessy Dept. Computer Science NUIM CS351

  2. Ij 1. Customized Digital Computer Oj Task j Task k Ik Ok Rig different circuit for each task Mark Hennessy Dept. Computer Science NUIM CS351

  3. 2. Stored Program Computing • von Neumann showed the existence of a Universal Machine (hardware) that can be customized using control inputs to carry out different tasks. • Software is the encoding of the task to control this machine. encoding(Tj) Ij Oj Mark Hennessy Dept. Computer Science NUIM CS351

  4. Imperative Languages • Model of Computation • ALU + Memory + Input + Output (von Neumann architecture) • Levels of Abstraction (“Human Interface”) • Machine Language • Binary Representation of the task • Assembly Language • Symbolic Representation of the task Mark Hennessy Dept. Computer Science NUIM CS351

  5. Imperative Languages - FORTRAN • Stands for FORmula TRANslantion. • Invented in the 1950’s as the first high level programming language i.e used a compiler. • Hello World Example: C FORTRAN IV WAS ONE OF THE FIRST PROGRAMMING C LANGUAGES TO SUPPORT SOURCE COMMENTS WRITE (6,7) 7 FORMAT(13H HELLO, WORLD) STOP END Mark Hennessy Dept. Computer Science NUIM CS351

  6. Imperative Languages – ALGOL 60 • Stands for ALGOrithmic Language • Defined in 1960 and was the first to introduce features still in use today: block structure and syntax defined by a grammar. procedure Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k); value n, m; array a; integer n, m, i, k; real y; comment The absolute greatest element of the matrix a, of size n by m is transferred to y, and the subscripts of this element to i and k; begininteger p, q; y := 0; i := k := 1; for p:=1 step 1 until n do for q:=1 step 1 until m do if abs(a[p, q]) > y then begin y := abs(a[p, q]); i := p; k := q end end Absmax Mark Hennessy Dept. Computer Science NUIM CS351

  7. Imperative Languages - C • The most successful ALGOL type language. • Lexical variable scope and recursion • A static type system which prevents many meaningless operations • Function parameters are generally passed by value (pass-by-reference is achieved in C by explicitly passing pointer values) • Heterogeneous aggregate data types (struct in C) which allow related data elements to be combined and manipulated as a unit • A small set (around 30) of reserved keywords Mark Hennessy Dept. Computer Science NUIM CS351

  8. Functional Languages • Imperative programs are concerened with programming a series of instructions that change the state of program towards giving the solution. • Functional Programming is concerned with viewing a program as a series of mathematical functions. • Based upon the maths model of Lambda Calculus, developed by Turing, Church and Kleene in the 1930’s. • Church’s thesis says that there is no one form of computation that is any more powerful than another. • This hold true as we are studying Paradigms! Mark Hennessy Dept. Computer Science NUIM CS351

  9. Functional Languages • Turing developed a model of computation called the Turing Machine …. TCS course. • Church developed lambda calculus. • This is based on the notion of parameterised expressions, which forms the basis of Functional Programming. • Passing arguments to methods. Mark Hennessy Dept. Computer Science NUIM CS351

  10. Functional Programming • Introduced into programming the notions of: • First class and higher order functions • Polymorphism • Lists • Recursion • Constructors • Garbage Collection Mark Hennessy Dept. Computer Science NUIM CS351

  11. Functional Programming • Difference between FP and Imperative programming: IP: “To compute the gcd of a and b, check to see if a and b are equal. If so print one of them and exit. Otherwise replace the larger one by their difference and repeat.” FP: “The gcd of a and b is defined to be a when a=b, and to be the gcd of c and d when a!=b, where c is the smaller of a and b and d is their difference. To compute the gcd of a given pair of numbers, expand and simplify this definition until it finishes. Mark Hennessy Dept. Computer Science NUIM CS351

  12. Functional Languages - Lisp • Stands for List Processing • Same vintage as Fortran and ALGOL. • Allows for operations on lists • Eg car(0, 2, 4, 6) = 0 • Eg cdr(0, 2, 4, 6) = (2, 4, 6) • Lisp Program for factorials: (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1))))) Mark Hennessy Dept. Computer Science NUIM CS351

  13. Functional Languages - ML • Stands for Meta Language • Functional Language with syntax closer to what you are familiar with. Will be doing practicals with it! (CaML). • CaML Program for factorials. let rec fac n =    if n <= 1    then n    else n * fac(n-1);; Mark Hennessy Dept. Computer Science NUIM CS351

  14. Logic Programming • Designed to allow mathematical axioms help prove a theorem. • Based on the idea of a Horn clause • H <- B1, B2,….Bn • The arrow means “if” and the commas mean “and” • We will be studying Logic programming via Prolog Mark Hennessy Dept. Computer Science NUIM CS351

  15. Logic Programming - Prolog • Name derives from the French programmation en logique. • Dates from the early 1970’s. • Based upon Predicate Calculus, the system uses backtracking. Example Prolog Program for Factorials: factorial(0,1). factorial(N,F) :- N>0, N1 is N-1, factorial(N1,F1), F is N * F1. Mark Hennessy Dept. Computer Science NUIM CS351

  16. Object Oriented Programming • Current paradigm. We write classes such that data is hidden, ideas are abstracted and code is re-usable! In theory…. • Simula -> Smalltalk & Ada -> C++ -> Java • Sub paradigms • Aspect Oriented Programming • Generic Programming via Templates • We will use C++ to show some advanced OO features and generic programming. Mark Hennessy Dept. Computer Science NUIM CS351

  17. Scripting • Another form of programming is via scripting. • Huge amount of scripting languages, Awk, sed, Bash, Javascript, UnrealScript etc • We will intoduce scripting via Bash and Python in this course. • Python uses dynamic typing and features a very clean syntax. Multi Paradigm! Mark Hennessy Dept. Computer Science NUIM CS351

  18. Scripting - Python • Indentation is essential! • Sample factorial function: def fac ( num ): if num == 1: return 1 else : return num * fac(num-1) Mark Hennessy Dept. Computer Science NUIM CS351

More Related