SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
Programming
languages


        www.tudorgirba.com
computation



information                 information
              computer
A language is a set of sequences of symbols that
we interpret to attribute meaning.
ambiguous

      All elements of an array a of length N are either zero or one

(1)   ∀i: 0≤i<N: ( ai=0 ∨ ai=1 )


(2)   (∀i: 0≤i<N: ai=0) ∨ (∀i: 0≤i<N: ai=1)




                                                     Example
A programming language is a a language for
communicating software designs.
programming = modeling
# Compute factorials
def fact(n)
  if n == 0
    1
  else
    n * fact(n-1)
  end
end

puts fact(ARGV[0].to_i)
# Compute factorials
             def fact(n)
               if n == 0
                 1
               else
                 n * fact(n-1)
               end
             end


statements   puts fact(ARGV[0].to_i)
# Compute factorials
             def fact(n)
               if n == 0
                 1
               else
                 n * fact(n-1)         expression
               end
             end


statements   puts fact(ARGV[0].to_i)
# Compute factorials       variables
             def fact(n)
               if n == 0
                 1
               else
                 n * fact(n-1)         expression
               end
             end


statements   puts fact(ARGV[0].to_i)
# Compute factorials       variables
             def fact(n)
               if n == 0
                                          literals
                 1
               else
                 n * fact(n-1)         expression
               end
             end


statements   puts fact(ARGV[0].to_i)
# Compute factorials       variables
             def fact(n)
               if n == 0
                                          literals
                 1
               else
control          n * fact(n-1)         expression
constructs     end
             end


statements   puts fact(ARGV[0].to_i)
functions



             # Compute factorials       variables
             def fact(n)
               if n == 0
                                          literals
                 1
               else
control          n * fact(n-1)         expression
constructs     end
             end


statements   puts fact(ARGV[0].to_i)
comments    functions



             # Compute factorials       variables
             def fact(n)
               if n == 0
                                          literals
                 1
               else
control          n * fact(n-1)         expression
constructs     end
             end


statements   puts fact(ARGV[0].to_i)
in g, 1937
Alan Tur
Smalltalk =   = Java
programming = modeling
Imperative
data + algorithms
Imperative
data + algorithms




Object-oriented
objects + messages
Imperative           Functional
data + algorithms    stateless + pure functions




Object-oriented
objects + messages
Imperative           Functional
data + algorithms    stateless + pure functions




Object-oriented      Logic
objects + messages   facts + rules
Jacquard loom
1801
Babbage’s
Analytical
Engine
1837
Church’s
Lambda Calculus
1932


(λ x. (λ y. x)) a b

(λ y. a) b

a
Touring Machine
1936
Harvard
Mark I
1944
Subroutine
1949
Assembly code
1950s
Fortran
1955


 C   AREA OF A TRIANGLE - HERON'S FORMULA
 C   INPUT - CARD READER UNIT 5, INTEGER INPUT
 C   OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT
 C   INPUT ERROR DISPAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING
         INTEGER A,B,C
         READ(5,501) A,B,C
     501 FORMAT(3I5)
         IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) STOP 1
         S = (A + B + C) / 2.0
         AREA = SQRT( S * (S - A) * (S - B) * (S - C))
         WRITE(6,601) A,B,C,AREA
     601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,12HSQUARE UNITS)
         STOP
         END
ALGOL
1958
begin
	 ...
end



<statement> ::= <unconditional statement>
	 | <conditional statement>
	 | <for statement>
...



f()
	 ...
	 f()
Lisp
1958
(defun factorial (n)
  (if (= n 1)
      1
      (* n (factorial (- n 1)))))




Garbage collection




Programs = Data
COBOL
1959
ADD YEARS TO AGE.
MULTIPLY PRICE BY QUANTITY GIVING COST.
SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST.




Modules
Basic
1964
10 INPUT "What is your name: ", U$
20 PRINT "Hello "; U$
30 INPUT "How many stars do you want: ", N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars? ", A$
100 IF LEN(A$) = 0 THEN GOTO 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
130 PRINT "Goodbye "; U$
140 END
JCL
1964
//IS198CPY   JOB (IS198T30500),'COPY JOB',CLASS=L,MSGCLASS=X
//COPY01     EXEC PGM=IEBGENER
//SYSPRINT   DD SYSOUT=*
//SYSUT1     DD DSN=OLDFILE,DISP=SHR
//SYSUT2     DD DSN=NEWFILE,
//              DISP=(NEW,CATLG,DELETE),
//              SPACE=(CYL,(40,5),RLSE),
//              DCB=(LRECL=115,BLKSIZE=1150)
//SYSIN      DD DUMMY
Semaphores
1965
P1 — acquire resource X
	 … critical section
V1 — release resource X



P2 — acquire resource X
	 … critical section
V2 — release resource X
Planner                Prolog
1969                   1972
man(socrates).
mortal(X) :- man(X).
Planner                Prolog
1969                   1972
man(socrates).
mortal(X) :- man(X).




?- mortal(socrates).
Yes
Planner                Prolog
1969                   1972
man(socrates).
mortal(X) :- man(X).




?- mortal(socrates).
Yes




?- mortal(elvis).
No
Pascal
1970
function gcd (a, b: integer) : result real;
var x : integer;
begin
    if b= 0 then gcd := a
    else
      begin
         x := a;
         while (x >= b) do
          begin
            x := x - b
          end;
          gcd := gcd(b,x)
      end
end
C
1972
#include <stdio.h>
//echo the command line arguments
int main (int argc, char* argv[]) {
	 int i;
	 for (i=1; i<argc; i++) {
	 	 printf("%s ", argv[i]);
	 }
	 printf("n");
	 return 0;
}
Smalltalk
1972
Integer»factorial
	 self = 0 ifTrue: [^ 1].
	 self > 0 ifTrue: [^ self * (self - 1) factorial].
	 self error: 'Not valid for negative integers'




5 factorial -> 120




Everything is an Object
Everything happens by sending messages
Monitors
1974
public class Account {
	 protected int assets = 0;
	 ...
	 public synchronized void withdraw(int amount) {
	 	 while (amount > assets) {
	 	 	 try {
	 	 	 	 wait();
	 	 	 } catch(InterruptedException e) { }
	 	 }
	 	 assets -= amount;
	 }
	 ...
}
Bourne shell
1977
cat Notes.txt
| tr -c '[:alpha:]' '012'
| sed '/^$/d’
| sort
| uniq –c
| sort –rn
| head -5
SQL
1978
SELECT *
	 FROM Book
	 WHERE price > 100.00
	 ORDER BY title;
Perl                CGI
1978                1993
#!/usr/bin/perl -w
print "Content-type: text/htmlnn";
print <<'eof'
<html><head><title>Directory contents</title></head>
<body>
<h1>Directory contents</h1><ul>
eof
;
@files = <*>;
foreach $file (@files) {
	 print '<li><a href="' . $file . '">' . $file . "</li>n";
}
print "</ul></body></html>n";
__END__
JavaScript   Ajax
1995         2005
programming = modeling
Tudor Gîrba
        www.tudorgirba.com




creativecommons.org/licenses/by/3.0/

Weitere ähnliche Inhalte

Was ist angesagt?

Lec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrencesLec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrencesAnkita Karia
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfixSelf-Employed
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluationJeeSa Sultana
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsMamta Pandey
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Abhimanyu Mishra
 
Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14IIUM
 
Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14IIUM
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cflSampath Kumar S
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Sets, maps and hash tables (Java Collections)
Sets, maps and hash tables (Java Collections)Sets, maps and hash tables (Java Collections)
Sets, maps and hash tables (Java Collections)Fulvio Corno
 
Applications of stack
Applications of stackApplications of stack
Applications of stackeShikshak
 
Project on digital vlsi design
Project on digital vlsi designProject on digital vlsi design
Project on digital vlsi designDINESH DEVIREDDY
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfixSenthil Kumar
 

Was ist angesagt? (20)

Lec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrencesLec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrences
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfix
 
Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions
 
Maps&hash tables
Maps&hash tablesMaps&hash tables
Maps&hash tables
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
 
Prefix Postfix
Prefix PostfixPrefix Postfix
Prefix Postfix
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Circular queues
Circular queuesCircular queues
Circular queues
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
 
Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14
 
Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14Csc1100 lecture03 ch03-pt1-s14
Csc1100 lecture03 ch03-pt1-s14
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Sets, maps and hash tables (Java Collections)
Sets, maps and hash tables (Java Collections)Sets, maps and hash tables (Java Collections)
Sets, maps and hash tables (Java Collections)
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Project on digital vlsi design
Project on digital vlsi designProject on digital vlsi design
Project on digital vlsi design
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 

Andere mochten auch

Andere mochten auch (8)

12 - Overview
12 - Overview12 - Overview
12 - Overview
 
08 - Complexity
08 - Complexity08 - Complexity
08 - Complexity
 
04 - Sets
04 - Sets04 - Sets
04 - Sets
 
02 - Boolean algebra
02 - Boolean algebra02 - Boolean algebra
02 - Boolean algebra
 
05 - Relations
05 - Relations05 - Relations
05 - Relations
 
07 - Graphs
07 - Graphs07 - Graphs
07 - Graphs
 
06 - Trees
06 - Trees06 - Trees
06 - Trees
 
10 - Models and languages
10 - Models and languages10 - Models and languages
10 - Models and languages
 

Ähnlich wie Programming languages overview

Monadologie
MonadologieMonadologie
Monadologieleague
 
Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesEelco Visser
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptxPython Homework Help
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptxPython Homework Help
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance HaskellJohan Tibell
 
Pydiomatic
PydiomaticPydiomatic
Pydiomaticrik0
 
Arrays and structures
Arrays and structuresArrays and structures
Arrays and structuresMohd Arif
 
Good functional programming is good programming
Good functional programming is good programmingGood functional programming is good programming
Good functional programming is good programmingkenbot
 
Class 18: Measuring Cost
Class 18: Measuring CostClass 18: Measuring Cost
Class 18: Measuring CostDavid Evans
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonshin
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingSaurabh Singh
 
Sienna 10 dynamic
Sienna 10 dynamicSienna 10 dynamic
Sienna 10 dynamicchidabdu
 

Ähnlich wie Programming languages overview (20)

Monadologie
MonadologieMonadologie
Monadologie
 
Algorithms Design Homework Help
Algorithms Design Homework HelpAlgorithms Design Homework Help
Algorithms Design Homework Help
 
Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languages
 
Algorithms Design Exam Help
Algorithms Design Exam HelpAlgorithms Design Exam Help
Algorithms Design Exam Help
 
Struct examples
Struct examplesStruct examples
Struct examples
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptx
 
Mgm
MgmMgm
Mgm
 
Ch5b.pdf
Ch5b.pdfCh5b.pdf
Ch5b.pdf
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptx
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Pydiomatic
PydiomaticPydiomatic
Pydiomatic
 
Python idiomatico
Python idiomaticoPython idiomatico
Python idiomatico
 
Arrays and structures
Arrays and structuresArrays and structures
Arrays and structures
 
Functions
Functions Functions
Functions
 
Good functional programming is good programming
Good functional programming is good programmingGood functional programming is good programming
Good functional programming is good programming
 
Matlab integration
Matlab integrationMatlab integration
Matlab integration
 
Class 18: Measuring Cost
Class 18: Measuring CostClass 18: Measuring Cost
Class 18: Measuring Cost
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluiton
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional Programming
 
Sienna 10 dynamic
Sienna 10 dynamicSienna 10 dynamic
Sienna 10 dynamic
 

Mehr von Tudor Girba

Beyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismBeyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismTudor Girba
 
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Tudor Girba
 
Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Tudor Girba
 
Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Tudor Girba
 
Humane assessment on cards
Humane assessment on cardsHumane assessment on cards
Humane assessment on cardsTudor Girba
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingTudor Girba
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks laterTudor Girba
 
Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Tudor Girba
 
Humane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomHumane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomTudor Girba
 
Moose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeMoose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeTudor Girba
 
Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Tudor Girba
 
The emergent nature of software systems
The emergent nature of software systemsThe emergent nature of software systems
The emergent nature of software systemsTudor Girba
 
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Tudor Girba
 
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Tudor Girba
 
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Tudor Girba
 
Demo-driven innovation teaser
Demo-driven innovation teaserDemo-driven innovation teaser
Demo-driven innovation teaserTudor Girba
 
Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Tudor Girba
 
Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Tudor Girba
 
Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Tudor Girba
 

Mehr von Tudor Girba (20)

Beyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismBeyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalism
 
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
 
GT Spotter
GT SpotterGT Spotter
GT Spotter
 
Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)
 
Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Don't demo facts. Demo stories!
Don't demo facts. Demo stories!
 
Humane assessment on cards
Humane assessment on cardsHumane assessment on cards
Humane assessment on cards
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective Thinking
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks later
 
Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)
 
Humane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomHumane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development room
 
Moose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeMoose: how to solve real problems without reading code
Moose: how to solve real problems without reading code
 
Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)
 
The emergent nature of software systems
The emergent nature of software systemsThe emergent nature of software systems
The emergent nature of software systems
 
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
 
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
 
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
 
Demo-driven innovation teaser
Demo-driven innovation teaserDemo-driven innovation teaser
Demo-driven innovation teaser
 
Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)
 
Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)
 
Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011
 

Programming languages overview

  • 1. Programming languages www.tudorgirba.com
  • 2. computation information information computer
  • 3. A language is a set of sequences of symbols that we interpret to attribute meaning.
  • 4. ambiguous All elements of an array a of length N are either zero or one (1) ∀i: 0≤i<N: ( ai=0 ∨ ai=1 ) (2) (∀i: 0≤i<N: ai=0) ∨ (∀i: 0≤i<N: ai=1) Example
  • 5. A programming language is a a language for communicating software designs.
  • 6.
  • 7.
  • 8.
  • 9.
  • 11. # Compute factorials def fact(n) if n == 0 1 else n * fact(n-1) end end puts fact(ARGV[0].to_i)
  • 12. # Compute factorials def fact(n) if n == 0 1 else n * fact(n-1) end end statements puts fact(ARGV[0].to_i)
  • 13. # Compute factorials def fact(n) if n == 0 1 else n * fact(n-1) expression end end statements puts fact(ARGV[0].to_i)
  • 14. # Compute factorials variables def fact(n) if n == 0 1 else n * fact(n-1) expression end end statements puts fact(ARGV[0].to_i)
  • 15. # Compute factorials variables def fact(n) if n == 0 literals 1 else n * fact(n-1) expression end end statements puts fact(ARGV[0].to_i)
  • 16. # Compute factorials variables def fact(n) if n == 0 literals 1 else control n * fact(n-1) expression constructs end end statements puts fact(ARGV[0].to_i)
  • 17. functions # Compute factorials variables def fact(n) if n == 0 literals 1 else control n * fact(n-1) expression constructs end end statements puts fact(ARGV[0].to_i)
  • 18. comments functions # Compute factorials variables def fact(n) if n == 0 literals 1 else control n * fact(n-1) expression constructs end end statements puts fact(ARGV[0].to_i)
  • 20. Smalltalk = = Java
  • 21.
  • 23.
  • 26. Imperative Functional data + algorithms stateless + pure functions Object-oriented objects + messages
  • 27. Imperative Functional data + algorithms stateless + pure functions Object-oriented Logic objects + messages facts + rules
  • 30. Church’s Lambda Calculus 1932 (λ x. (λ y. x)) a b (λ y. a) b a
  • 35. Fortran 1955 C AREA OF A TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING INTEGER A,B,C READ(5,501) A,B,C 501 FORMAT(3I5) IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C)) WRITE(6,601) A,B,C,AREA 601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,12HSQUARE UNITS) STOP END
  • 36. ALGOL 1958 begin ... end <statement> ::= <unconditional statement> | <conditional statement> | <for statement> ... f() ... f()
  • 37. Lisp 1958 (defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1))))) Garbage collection Programs = Data
  • 38. COBOL 1959 ADD YEARS TO AGE. MULTIPLY PRICE BY QUANTITY GIVING COST. SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST. Modules
  • 39. Basic 1964 10 INPUT "What is your name: ", U$ 20 PRINT "Hello "; U$ 30 INPUT "How many stars do you want: ", N 40 S$ = "" 50 FOR I = 1 TO N 60 S$ = S$ + "*" 70 NEXT I 80 PRINT S$ 90 INPUT "Do you want more stars? ", A$ 100 IF LEN(A$) = 0 THEN GOTO 90 110 A$ = LEFT$(A$, 1) 120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30 130 PRINT "Goodbye "; U$ 140 END
  • 40. JCL 1964 //IS198CPY JOB (IS198T30500),'COPY JOB',CLASS=L,MSGCLASS=X //COPY01 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=OLDFILE,DISP=SHR //SYSUT2 DD DSN=NEWFILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(40,5),RLSE), // DCB=(LRECL=115,BLKSIZE=1150) //SYSIN DD DUMMY
  • 41. Semaphores 1965 P1 — acquire resource X … critical section V1 — release resource X P2 — acquire resource X … critical section V2 — release resource X
  • 42. Planner Prolog 1969 1972 man(socrates). mortal(X) :- man(X).
  • 43. Planner Prolog 1969 1972 man(socrates). mortal(X) :- man(X). ?- mortal(socrates). Yes
  • 44. Planner Prolog 1969 1972 man(socrates). mortal(X) :- man(X). ?- mortal(socrates). Yes ?- mortal(elvis). No
  • 45. Pascal 1970 function gcd (a, b: integer) : result real; var x : integer; begin if b= 0 then gcd := a else begin x := a; while (x >= b) do begin x := x - b end; gcd := gcd(b,x) end end
  • 46. C 1972 #include <stdio.h> //echo the command line arguments int main (int argc, char* argv[]) { int i; for (i=1; i<argc; i++) { printf("%s ", argv[i]); } printf("n"); return 0; }
  • 47. Smalltalk 1972 Integer»factorial self = 0 ifTrue: [^ 1]. self > 0 ifTrue: [^ self * (self - 1) factorial]. self error: 'Not valid for negative integers' 5 factorial -> 120 Everything is an Object Everything happens by sending messages
  • 48. Monitors 1974 public class Account { protected int assets = 0; ... public synchronized void withdraw(int amount) { while (amount > assets) { try { wait(); } catch(InterruptedException e) { } } assets -= amount; } ... }
  • 49. Bourne shell 1977 cat Notes.txt | tr -c '[:alpha:]' '012' | sed '/^$/d’ | sort | uniq –c | sort –rn | head -5
  • 50. SQL 1978 SELECT * FROM Book WHERE price > 100.00 ORDER BY title;
  • 51. Perl CGI 1978 1993 #!/usr/bin/perl -w print "Content-type: text/htmlnn"; print <<'eof' <html><head><title>Directory contents</title></head> <body> <h1>Directory contents</h1><ul> eof ; @files = <*>; foreach $file (@files) { print '<li><a href="' . $file . '">' . $file . "</li>n"; } print "</ul></body></html>n"; __END__
  • 52. JavaScript Ajax 1995 2005
  • 53.
  • 55. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/