Académique Documents
Professionnel Documents
Culture Documents
Programming Domains
Scientific applications
Large number of floating point computations FORTRAN and ALGOL 60
Business applications
Produce reports, use decimal numbers and characters COBOL
Artificial intelligence
Symbols rather than numbers manipulated LISP (1965), Logic programming using PROLOG (1997), SCHEME (a dialect of LISP)
Programming Domains
Systems programming
Need efficiency because of continuous use IBM PL/S (a dialect of PL/I 1970s) UNIX (1989 in C)
Scripting languages
Put a list of commands in a file to be executed The first language named sh (shell) Ksh (developed at Bell lab -1995) Tcl (developed at Berkeley -1994) Perl (2000) combination of sh and awk
Popularity increased by www - good for CGI programming
Special-purpose languages
Readability
Control statement
Earlier version of FORTRAN does not have a loop control, instead the goto statement are used to implement loops In C: while (inc 20) { while (sum 100) { sum+= inc; } inc++; } In FORTRAN 77 style:
L1:
Expressivity
Count++ or count=count+1 ?
Reliability
Factors:
Type checking Exception handling
c? c++? Java?
Programming Paradigms
1. Imperative
Structured Programming Object Oriented Programming Distributed Programming
2. Declarative
Functional Programming Logic Programming Database Languages
1. Imperative Languages
Describes computation in terms of statements that change a program state Central features are variables, assignment statements, and iteration Imperative programs define sequences of commands for the computer to perform Control is the responsibility of the programmer It is much more in tune with the computer community's way of thinking C, Fortran, Pascal, Pascal
2. Declarative Languages
Expresses what the program should accomplish without prescribing how to do it in terms of sequences of actions to be taken Expresses the logic of a computation without describing its control flow No assignment for the variables Lisp, Scheme, SQL
Distributed Programming
Functional Programming - 3
Involves no notion of variable or assignment to variables Concentrates on values and functions instead of memory locations Repetitive operations are not expressed by loops but by recursive functions
Functional Programming - 4
Common functional programming language and its gcd application is given below
Logic Programming - 2
A program consists of a set of statements that describe what is true about a desired result, as opposed to giving a particular sequence of statements that must be executed in a fixed order to produce the result Prolog is widely used logic programming Example code for gcd
Logic Programming - 3
1-25
before (jefferson, lincoln). before (lincoln, fdr). before (fdr, kennedy). before (kennedy, nixon).
Exercises
?-before(lincoln, fdr) ?-president (jefferson, lewis_and_clark) ?-before(first_moon_landing , cuban_missle_crisis)
Questions?
In what language UNIX is written? What is aliasing? What is exception handling? What does it mean for a program to be reliable? Which is faster, compiler or interpreter? What does a linker do? What arguments can you make for the idea of a single language for all the programming domains? Describe the advantages and disadvantages of some programming environments you have used.