Sunteți pe pagina 1din 16

7/12/2007

Š Babbage initiated programmable


computers
Š Invented the difference engine
ƒ Polynomial
y actions
Part I ƒ Using finite differences
ƒ Supported programmable
output formatting!
Amir Vaxman
Still not a freely programmed
device…

7/12/2007 1 7/12/2007 2

Š Born Augusta Ada King, daughter of Š Herman Hollerith encoded train


Lord Byron timetables on punched cards.
Š Known for having written a Š First usage of codes to express
description
p of Babbage's
g early
y information separately.
p y
mechanical GP computer
Š An adept scientific author, she
devised a method to compute
Bernoulli’s numbers.

7/12/2007 3 7/12/2007 4

Š Hollerith Got the idea from train


conductor punch tickets
Š Used to read and collate the Š Introduced by Church and Kleene in the
American census of 1890 (19)30’s.
Š The machine originated with Š A formal system – a logical language – defining
Joseph-Marie Jacquard in his the set of computable
p functions.
textile factory Š Equivalent to the Turing Machine formalism

Š Examples (f is the incremental function)


Š The CTR (later: IBM) census ƒ PLUS := λ m n f x. n f (m f x)
machine utilized these cards ƒ MULT := λ m n. m (PLUS n) 0,

7/12/2007 5 7/12/2007 6

1
7/12/2007

Š Turing is considered the father of Š A machine that implements


computer science. Turing’s universal Machine
Š Invented the idea of an Algorithm, Š The separations between
and the notions of computability
p y CPU, CU and Memoryy
Š Both Turing and Church proved that allows for general purpose
Hilbert’s Entscheidungsproblem programming
has a negative answer.

Š Can any truth be computationally


acknowledged? Guess not!
7/12/2007 7 7/12/2007 8

Š Konrad Zuse Built the Z3 – the first Š German: “Plan Calculus”


general purpose program-stored Š First high-level non-Von-Neumann
computer.
“programming language”
Š Proved to be Turing complete in 1998.
Š A set of notions invented by Zuse
Š Was never implemented..
P1 max3 (V0[:8.0],V1[:8.0],V2[:8.0]) => R0[:8.0]
max(V0[:8.0],V1[:8.0]) => Z1[:8.0]
max(Z1[:8.0],V2[:8.0]) => R0[:8.0]
END

P2 max (V0[:8.0],V1[:8.0]) => R0[:8.0]


V0[:8.0] => Z1[:8.0]
(Z1[:8.0] < V1[:8.0]) -> V1[:8.0] => Z1[:8.0]
Z1[:8.0] =>R0[:8.0]
7/12/2007 9 7/12/2007 END 10

Š Invented by Mauchly, and implemented for the Š Developed during the 50’s
BINAC computer. Š Mapped human understandable code to
Š A “Hand Compiled” Language machine code – usually 1-to-1
correspondence.
p
Š Architecture dependant.
X3 = (X1+Y1)/X1*Y1 =>
Š Examples:
X3 03 09 X1 07 Y1 02 04 X1 =>
ƒ MIPS
07Y10204X1Y1.
ƒ Sun SPARC
0000X30309X1
ƒ PDP 11

7/12/2007 11 7/12/2007 12

2
7/12/2007

Š Noam Chomsky invented generative Š BNF is a metasyntax used to describe formal


languages.
grammars. i.e. a method to parse and realize
Š Was developed to express the context-free grammars.
strings.
Š Was used to create ALGOL.
Š He also created the Chomsky y Hierarchy
y Š Example (U.S. postal address):
<postal-address> ::= <name-part> <street-address> <zip-part>
<name-part> ::= <personal-part> <last-name> <opt-jr-part>
<EOL> | <personal-part> <name-part> <EOL> <personal-part>
::= <first-name> | <initial> "."
<street-address> ::= <opt-apt-num> <house-num> <street-name>
<EOL>
<zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL>

7/12/2007 13 7/12/2007 14

Š A few languages set the basic template for


known languages today. Š FORmula TRANslator.
ƒ Fortran Invented by IBM team lead
ƒ ALGOL by John W. Backus.
ƒ COBOL Š Not the first high-level
ƒ Lisp programming language, nor
ƒ Simula the first compiled language,
but the first successful one.
Š Fathered GOTO languages
(such as BASIC)

7/12/2007 15 7/12/2007 16

Š ALGOrithmic Š COmmon Business-


Language Oriented Language.
Š Designed specifically Š Still in active use! Mostly
for scientific for banking and (old) DB
calculations. accounting.
ti
Š Did not support local
Š Structure similar to C
variables, recursion,
Š Like Fortran – dynamic memory
machine independent allocation, or structured
programming constructs.

7/12/2007 17 7/12/2007 18

3
7/12/2007

Š LISt Processing Š The first language to


Š A family of functional programming languages. utilize the ideas of
Š Built as a model to utilize Church’ λ-calculus. Object-Oriented
Š Fundamental operations
p CAR ((head of list)) and Programming,
CDR (tail of list) originate in the structure of the introducing objects,
IBM 704 classes, garbage
collection and so
Š Examples: forth.
ƒ ((lambda (arg) (+ arg 1)) 5) – Evaluates to 6
ƒ (append '(1 2) '(3 4)) - Output: (1 2 3 4)

7/12/2007 19 7/12/2007 20

Š Some languages utilized the Š An Array Programming language.


ideas of these fundamental
languages. Š May be considered the father of MATLAB..
Š BASIC: A tutorial language Š Used incomprehensible characters.
which became popular in
PCs (and in ATARI!)
because of its simplicity. Š The following example assigns the set of
Š Inserting lines in the middle primes in the range [1,R] to the array PRIMES!
was a headache..
Š Not all implementations PRIMES : (~ R ∈ R°.xR ) / R ← 1 ↓ R
supported GOSUB
recursion.
7/12/2007 21 7/12/2007 22

Š Was widely used as a tutorial language for 1st Š With the development of languages, several
semester students. principles guided the needs:
Š Totally free-form – ƒ Application vs. system programming
No reserved keywords. ƒ Imperative languages (OOP or non-OOP), functional
languages, logic.
ƒ Semantics: scopes, recursion, encapsulation,
modularity, platform-independence
ƒ Memory abstraction
ƒ Type checking
ƒ Compiled vs. interpreted.

7/12/2007 23 7/12/2007 24

4
7/12/2007

Š A basic part of Turing- Š There are many variants, some are newer.
completeness (can be Š Call-by-Value – most common, used in C and
realized with loops) scheme, for example. The expression is
Š Had to submit to the evaluated and then ppassed as argument.
g
invention of the function call Š Call-by-reference – using “L-Value”. Used by
stack. most modern languages, and some middle
Š Early languages, like ones (e.g. ML, and to some extent FORTRAN).
FORTRAN on the HP 210
computer did not support
recursion.
7/12/2007 25 7/12/2007 26

Š The same syntax may cause different effect in Example #1:


different languages (and sometimes, in the (String) x
same language with a different compiler!) Š Same syntax in C++, Java
Š Commonly-affected
y areas: Š Semantics:
ƒ Order of evaluation in an IF statement ƒ C++: Blind Cast (always succeeds)
ƒ Default initialization of variable. ƒ Java: Checked cast (may fail at run-time)
ƒ Variable casting (example in next slide).

7/12/2007 27 7/12/2007 28

Š ”Ignoring inessential details” A mapping from integers onto { 0, 1 }


ƒ This is a bit-by-bit view
Š A computer is a complex
Š The programming model:
machine
ƒ Read a bit (from a location in memory)
ƒ Optionally change its value (0 <--> 1)
Š Many views of computers ƒ Write a bit (to a location in memory)
ƒ (of various level of abstraction)
Š Very difficult for most tasks
Š A programming language:
A simple yet comprehensive
view

7/12/2007 29 7/12/2007 30

5
7/12/2007

Š A computation - Reading/Writing values Š A computation – Evaluating a formula


from/into cells ƒ Almost like in the 7-th grade...
Š A Turing-machine based approach ƒ ... but with recursion
Š Additional abstraction evolved Š A Lambda-calculus based approach
ƒ Stack, types, ... Š Example: computing next factorial number
Š Example: Computing factorial numbers f (n) = nf (n − 1)
For n=1 to k
temp = n
x = x * temp
End for

7/12/2007 31 7/12/2007 32

Š A computation – Finding all tuples which satisfy Š Functional


certain conditions Š Logical
Š Imperative
Š A Relational-algebra based approach ƒ Object-oriented
j
ƒ ... but with recursion

Š Example: Computing next factorial number

( x, n) ∈ F ⇒ ( x ⋅ (n + 1), n + 1) ∈ F
7/12/2007 33 7/12/2007 34

35/57

Some of the languages from this


HoPL: The History Of Š
decade are still live and kicking
Programming Languages Š E.g.: ML, C, SQL, Smalltalk
Š Older languages are rarely used
today
Part 2

Itay Maman

236801 Seminar lecture – 9 Jul 2007

36/57

6
7/12/2007

Š Designer: Niklaus Wirth


function fib(N : integer) : longint;
Š Paradigm: Imperative
var
Š Type system: static, strong tmp, first, second : integer;
Š Based on: Algol begin
while n <> 0 do
Š Intended to be used as a teaching language begin
n := n - 1;
Š First Pascal compiler was written in Fortran tmp = first
i + second;
ƒ Subsequent version were bootstrapped first = second;
second = tmp;
end
fib := first;
end

37/57 38/57

Š Designer: Dennis Ritchie Š 1973- First Robust implementation


Š Paradigm: Imperative Š 1978- ”The C Programming Language” (AKA: K&R)
Š Type system: static, weak ƒ The de-facto standard

Š Based on: ALGOL, Assembly ƒ No type checking of parameters


ƒ Old style:

Š Designed for system-programming tasks int main(argc, argv)


int argc; char **argv; { ... }
ƒ Till 1973 the Unix kernel was written in assembly
y ((PDP-7,,
11) Š 1983- C's ANSI standard committee formed
Š 1988- 2nd edition published
Š Philosophy: Š 1989- ANSI standard ratified (AKA: C89)
ƒ Simple language => simple compiler ƒ function prototypes
ƒ Many language constructs are based on machine ƒ void pointers/functions, enum types
instructions Š 1990- ANSI C adopted by ISO
ƒ Fine-grain control over memory, I/O ƒ AKA: C90 ( == C89)
ƒ Minimal run-time support

39/57 40/57

Š Designers: Alan Kay, Dan Ingalls, Adele Goldberg


Š Paradigm: Object-oriented
Š Type system: dynamic, strong
Š Based on: Simula, Lisp
Class: CookieMonster
Š Philosophy: Superclass: Monster
Category: Sesame Street
ƒ Everything is an object
Instance variables: state hunger
ƒ Program is a data structure in memory
à The program can examine/modify itself nag
Š Three primitive constructs: | item |
item := self askForCookie.
ƒ send a message to a receiver
(item isKindOf: Cookie)
ƒ return a value ifTrue: [self eat: item]
ƒ assign a value to a variable ifFalse: [self complainAbout: item].

41/57 42/57

7
7/12/2007

Š Designers: Alain Colmerauer pred('Washington', 'Adams').


Š Paradigm: Logic programming pred('Adams', 'Jefferson').
Š Type system: varies pred('Jefferson', 'Madison').
pred('Madison', 'Monroe').
pred('Monroe', 'Adams').
Š Designed for AI tasks (searching in trees/graphs)
Š Philosophy: before(X,Z) :- pred(X,Z).
ƒ A rule defines an implication (right implies left) ( , ) :- pred(X,Y),
before(X,Z) p ( , ), before(Y,Z).
( , )
ƒ Predicate – A set of rules with the same left-hand side term
before(A,'Madison')?
ƒ Predicate invocation: <'Jefferson'>
à Returns all tuples matching the value passed-in <'Adams'>
<'Washington'>

43/57 44/57

Š Designer: Robin Milner


Š Paradigm: Functional
Š Large scale programs are here
Š Type system: static, strong, inferred Š Language features for coping
with the complexity of the code
Š A functional language w/ static type checking
ƒ Lisp is functional but dynamically typed
ƒ Not purely functional =>> Allows side effects

fun step x y 0 = x
| step x y n = step y (x+y) (n-1);

val fib = step 0 1;

45/57 46/57

Š Designer: Jean Ichbiah, S. Tucker Taft function fib(n : integer) return integer is
Š Paradigm: Imperative f : integer := 0;
Š Type system: static, strong s : integer := 1;
tmp : integer;
Š Based on: Algol 68, Pascal
begin
for i in 1..n loop
Š Developed for the US Department of Defence tmp := f + s;
Š Requirements f :=
: s;
ƒ Modular, safe, high level of abstraction
s := tmp;
end loop;
ƒ High maintainability return f;
ƒ Should replace ad-hoc hardware-dependent languages end fib;
à Frequent in embedded systems

47/57 48/57

8
7/12/2007

Š Designed using the ”waterfall” approach Š Designer: Bjarne Stroustrup


ƒ The same design procedure as in weapon systems Š Paradigm: Object-oriented
Š Type system: static, weak
Š 1975- Working group for a new computer language formed Š Based on: C, Simula
Š 1977- Ideal language specification, ”Ironman”, published
Š 1979- The Green proposal is chosen Š Philosophy:
Š 1980
1980- Ada
Ada'ss reference manual approved ƒ C
C'ss performance
Š 1983- First implementation validated ƒ Simula's features
ƒ + Ada becomes an ANSI standard Š Three major stages: 1985, 1989, 1998 (First standard)
Š 1987- DoD adopts the Ada mandate ƒ Next version: C++0x (...Hopefully x <= 9)
ƒ Requires the use of Ada in projects with > 30% new code Š Drawbacks: C, poor standard library, no GC
Š 1997- DoD adopts the COTS policy
ƒ Commercial Off-The-Shelf technologies

49/57 50/57

Š Designer: Bertrand Meyer


Š Paradigm: Object-oriented
Š Type system: static, strong
Š Based on: Simula, Ada

Š Software Engineering oriented


ƒ Design by Contract
ƒ Automatic documentation

51/57 52/57

fib (n: INTEGER): INTEGER is


require -- Design By Contract: Š Performance is less of a problem
pre_fib: n > 0 -- Precondition
local
i, tmp, f, s: INTEGER Š Hybrid software systems
do ƒ Interoperability
from
ƒ Rapid prototyping
f := 0; s := 1; i := 1;
until
i = n; Š The Internet
loop
tmp := f + s; f := s; s := tmp; ƒ Web servers
i = i + 1; ƒ Browser-side programs
end; ƒ Accessibility to open source libraries
Result := s;
end;

53/57 54/57

9
7/12/2007

Š Designer: Simon Peyton-Jones, Paul Hudak, Philip Wadler module Main where
Š Paradigm: Functional import System.Environment
Š Type system: static, strong, inferred
Š Based on: ML, Miranda fib = 1 : 1 : zipWith (+) fib (tail fib)

main = do
Š Philosophy: Purely functional args <- getArgs
ƒ No side effects (unless you ask nicely) print (fib !! (read(args!!0)-1))
(read(args!!0) 1))

Š 2D grammar
Š Lazy evaluation: fib is recursive but has no if's
Š do construct for sequential execution
Š Type inference

55/57 56/57

Š Designer: James Gosling


Is Java's popularity due its OO nature?
Š Paradigm: Object-oriented
Š Type system: static, strong Š Powerful runtime system
Š Based on: C++, Smalltalk, Eiffel ƒ JVM, JIT, GC

Š Philosophy Š A huge standard library


ƒ Compile once run anywhere ƒ Networking,
N t ki JDBC
JDBC, GUI
GUI, Th
Threading,
di C
Cryptography,
t h ...
ƒ Safe yet dynamic (applets)
ƒ =>Internet ready! Š Enterprise Applications
ƒ J2EE, hotswapping
Š As of 2006, mostly open sourced (!)
Š Unicode

57/57 58/57

Interpreters:
e p e e s: Thee Resurrection
esu ec o

59/57 60/57

10
7/12/2007

Š 1987- Perl
Š 1990- Python
Š 1991- Visual Basic
Š 1995- Ruby
e p e e s: Thee Resurrection
Interpreters: esu ec o Š 1995- Javascript
1995
Coming soon to an IDE near you Š 1997- PHP

Š => 2005- Ajax

61/57 62/57

Š Designer: Yukihiro Matsumoto


Š Paradigm: Object-oriented class Someone
Š Type system: dynamic, strong def initialize(name)
Š Based on: Smalltalk, Lisp, Python @name = name
end
end
Š Philosophy: ”programmer productivity and fun”
b = S
Someone.new("Bart")
("B t")
Š Highlights
ƒ Implicit declaration of setter, getters # puts b.name # Error: undefined method 'name'
ƒ Mixings, open classes/objects
class Someone
ƒ RoR: Ruby-on-Rails attr_accessor :name
à Framework for DB-based web application end

puts b.name # Output: 'Bart'

63/57 64/57

Š Designer: Rasmus Lerdorf .


Š Paradigm: Imperative .
Š Type system: dynamic, strong
Š Based on: C, Perl .
Š Highlights </languages>
ƒ Server side scripting <IDEs.abridged>
<IDEs abridged>
ƒ HTML text embedded within the source code
ƒ PHP = PHP: Hypertext Preprocessor .
.
<b>Server
<?php .
echo ' Side '
?>
Scripting</b>
65/57 66/57

11
7/12/2007

1976-VI 1976-Emacs

67/57 68/57

1986-GDB 1987-Turbo Pascal 4

69/57 70/57

1991-XEmacs 1994-DDD

71/57 72/57

12
7/12/2007

1996-Squeak 2002-Visual Studio .NET

73/57 74/57

2007-Eclipse 3.2.2
.
.
.
</IDEs.abridged>
<conclusions>
.
.
.

75/57 76/57

ƒ Productivity ƒ Machine code


ƒ Performance ƒ Virtual machine
p
ƒ Interpreter

Seems to be decided in favor of productivity


Strongly related to the question of portability...

77/57 78/57

13
7/12/2007

1) Machine specific languages: Assembly


ƒ Almost no portability
ƒ Static
ƒ Dynamic
2) Compiler + O/S isolate from hardware: Algol, C
ƒ Source compatibility on same O/S
ƒ Binary compatibility on same O/S & CPU
Currently, the hottest debate
3) Comprehensive standard libraries: Eiffel ƒ Manifested by the ”performance is not an issue”
ƒ Source compatibility on all platforms claim

4) Virtual machine: Java, Smalltalk


ƒ Full source + binary compatibility
79/57 80/57

Š No absolute answer
ƒ Functional
Š Too many contradicting factors
ƒ Imperative
Š Too many players (languages)
ƒ Very easy to produce a new language
Š Extremely difficult to measure the market
A 71-years old debate Š Still, here are a few attempts...

81/57 82/57

Source:
83/57 http://www.cs.berkeley.edu/~flab/languages.html Source:
84/57 http://radar.oreilly.com/archives/2007/03/programming_lan.html

14
7/12/2007

Source:
85/57 http://www.tiobe.com/index.htm?tiobe_index Source:
86/57 April 2005 data of http://www.tiobe.com

Š Software is cheaper the Hardware http://www.cs.fit.edu/~ryan/ada/ada-hist.html


http://www.tiobe.com/index.htm?tiobe_index
ƒ (to a certain degree)
http://radar.oreilly.com/archives/2007
Š A researcher can easily develop http://thomer.com/vi/vi.html
new language constructs http://www.squeak.org/Smalltalk/
Š => Wealth of languages http://acs.ucsd.edu/info/dbx.debug.php
ƒ Compared to hardware technologies http://www.research.att.com/~bs/homepage.html
ƒ Each making one small step forward http://pascalprogramming.byethost15.com
http://www.levenez.com/lang/history.html
Š => Languages evolve
http://en.wikipedia.org
Š It is hard to detect the major http://st-www.cs.uiuc.edu/balloon.html
trends http://www.sppn.nl/logo.html

87/57 88/57

.
http://www.juixe.com/techknow/index.php/2006/06/15/mixins-
in-ruby .
http://www.scriptol.org/fibonacci-any-programming-
language.html .
http://en.wikipedia.org/wiki/History_of_programming_language
s </conclusions>
http://www.whitehouse.gov/history/presidents/chronological.ht
http://www whitehouse gov/history/presidents/chronological ht </lecture>
ml
http://www.dcs.ed.ac.uk/home/stg/NOTES/node59.html

89/57 90/57

15
7/12/2007

91/57

16

S-ar putea să vă placă și