The Evolution of Computer Language.ppt - Technion – Israel …gotsman/236801/8-Programming... ·...
Transcript of The Evolution of Computer Language.ppt - Technion – Israel …gotsman/236801/8-Programming... ·...
7/12/2007
1
Part I
Amir Vaxman
7/12/2007 1
Babbage initiated programmable computersInvented the difference engine
Polynomial actionsyUsing finite differencesSupported programmableoutput formatting!
Still not a freely programmeddevice…
7/12/2007 2
Born Augusta Ada King, daughter of Lord ByronKnown for having written a description of Babbage's early p g ymechanical GP computerAn adept scientific author, she devised a method to compute Bernoulli’s numbers.
7/12/2007 3
Herman Hollerith encoded train timetables on punched cards.First usage of codes to express information separately.p y
7/12/2007 4
Hollerith Got the idea from train conductor punch ticketsUsed to read and collate the American census of 1890The machine originated with Joseph-Marie Jacquard in his textile factory
The CTR (later: IBM) census machine utilized these cards
7/12/2007 5
Introduced by Church and Kleene in the (19)30’s.A formal system – a logical language – defining the set of computable functions.pEquivalent to the Turing Machine formalism
Examples (f is the incremental function)PLUS := λ m n f x. n f (m f x) MULT := λ m n. m (PLUS n) 0,
7/12/2007 6
7/12/2007
2
Turing is considered the father of computer science.Invented the idea of an Algorithm, and the notions of computabilityp yBoth Turing and Church proved that Hilbert’s Entscheidungsproblem has a negative answer.
Can any truth be computationally acknowledged? Guess not!
7/12/2007 7
A machine that implements Turing’s universal MachineThe separations between CPU, CU and Memory yallows for general purpose programming
7/12/2007 8
Konrad Zuse Built the Z3 – the first general purpose program-stored computer.Proved to be Turing complete in 1998.
7/12/2007 9
German: “Plan Calculus”First high-level non-Von-Neumann “programming language”A set of notions invented by ZuseA set of notions invented by ZuseWas 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] END7/12/2007 10
Invented by Mauchly, and implemented for the BINAC computer.A “Hand Compiled” Language
X3 = (X1+Y1)/X1*Y1 =>X3 03 09 X1 07 Y1 02 04 X1 =>07Y10204X1Y1. 0000X30309X1
7/12/2007 11
Developed during the 50’sMapped human understandable code to machine code – usually 1-to-1 correspondence.pArchitecture dependant.Examples:
MIPSSun SPARCPDP 11
7/12/2007 12
7/12/2007
3
Noam Chomsky invented generative grammars. i.e. a method to parse and realize strings.He also created the Chomsky Hierarchyy y
7/12/2007 13
BNF is a metasyntax used to describe formal languages.Was developed to express the context-free grammars.Was used to create ALGOL.Example (U.S. postal address):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 14
A few languages set the basic template for known languages today.
FortranALGOLCOBOLLispSimula
7/12/2007 15
FORmula TRANslator. Invented by IBM team lead by John W. Backus.Not the first high-level programming language, nor the first compiled language, but the first successful one.Fathered GOTO languages (such as BASIC)
7/12/2007 16
ALGOrithmic LanguageDesigned specifically for scientific calculations.Structure similar to CLike Fortran –machine independent
7/12/2007 17
COmmon Business-Oriented Language.Still in active use! Mostly for banking and (old) DB
tiaccounting.Did not support local variables, recursion, dynamic memory allocation, or structured programming constructs.
7/12/2007 18
7/12/2007
4
LISt ProcessingA family of functional programming languages.Built as a model to utilize Church’ λ-calculus.Fundamental operations CAR (head of list) and p ( )CDR (tail of list) originate in the structure of the IBM 704
Examples:((lambda (arg) (+ arg 1)) 5) – Evaluates to 6(append '(1 2) '(3 4)) - Output: (1 2 3 4)
7/12/2007 19
The first language to utilize the ideas of Object-Oriented Programming, introducing objects, classes, garbage collection and so forth.
7/12/2007 20
Some languages utilized the ideas of these fundamental languages.BASIC: A tutorial language which became popular inwhich became popular in PCs (and in ATARI!) because of its simplicity.Inserting lines in the middle was a headache..Not all implementations supported GOSUB recursion.
7/12/2007 21
An Array Programming language.May be considered the father of MATLAB..Used incomprehensible characters.
The following example assigns the set of primes in the range [1,R] to the array PRIMES!
: (~ . ) / 1PRIMES R R xR R R∈ ° ← ↓
7/12/2007 22
Was widely used as a tutorial language for 1st
semester students.Totally free-form –No reserved keywords.No reserved keywords.
7/12/2007 23
With the development of languages, several principles guided the needs:
Application vs. system programmingImperative languages (OOP or non-OOP), functional languages, logic.Semantics: scopes, recursion, encapsulation, modularity, platform-independenceMemory abstractionType checkingCompiled vs. interpreted.
7/12/2007 24
7/12/2007
5
A basic part of Turing-completeness (can be realized with loops)Had to submit to the invention of the function call stack.Early languages, like FORTRAN on the HP 210 computer did not support recursion.
7/12/2007 25
There are many variants, some are newer.Call-by-Value – most common, used in C and scheme, for example. The expression is evaluated and then passed as argument.p gCall-by-reference – using “L-Value”. Used by most modern languages, and some middle ones (e.g. ML, and to some extent FORTRAN).
7/12/2007 26
The same syntax may cause different effect in different languages (and sometimes, in the same language with a different compiler!)Commonly-affected areas:y
Order of evaluation in an IF statementDefault initialization of variable.Variable casting (example in next slide).
7/12/2007 27
Example #1:(String) xSame syntax in C++, JavaSemantics:Semantics:
C++: Blind Cast (always succeeds) Java: Checked cast (may fail at run-time)
7/12/2007 28
”Ignoring inessential details”
A computer is a complex machine
Many views of computers(of various level of abstraction)
A programming language: A simple yet comprehensive view
7/12/2007 29
A mapping from integers onto { 0, 1 }This is a bit-by-bit view
The programming model: Read a bit (from a location in memory) Optionally change its value (0 <--> 1) Write a bit (to a location in memory)
Very difficult for most tasks
7/12/2007 30
7/12/2007
6
A computation - Reading/Writing values from/into cellsA Turing-machine based approachAdditional abstraction evolved
Stack, types, ...Example: Computing factorial numbersFor n=1 to k
temp = nx = x * temp
End for
7/12/2007 31
A computation – Evaluating a formulaAlmost like in the 7-th grade...... but with recursion
A Lambda-calculus based approachExample: computing next factorial number ( ) ( 1)f n nf n= −
7/12/2007 32
A computation – Finding all tuples which satisfy certain conditions
A Relational-algebra based approach... but with recursion
Example: Computing next factorial number
( , ) ( ( 1), 1)x n F x n n F∈ ⇒ ⋅ + + ∈
7/12/2007 33
FunctionalLogicalImperative
Object-orientedj
7/12/2007 34
35/57
HoPL: The History Of HoPL: The History Of Programming LanguagesProgramming Languages
Part 2Part 2
Itay Maman
236801 Seminar lecture – 9 Jul 2007
Some of the languages from this decade are still live and kickingE.g.: ML, C, SQL, SmalltalkOlder languages are rarely used today
36/57
7/12/2007
7
Designer: Niklaus WirthParadigm: ImperativeType system: static, strongBased on: Algol
Intended to be used as a teaching languageFirst Pascal compiler was written in Fortran
37/57
First Pascal compiler was written in FortranSubsequent version were bootstrapped
function fib(N : integer) : longint;var tmp, first, second : integer;
begin while n <> 0 dobegin
n := n - 1;i
38/57
tmp = first + second;first = second;second = tmp;
endfib := first;
end
Designer: Dennis RitchieParadigm: ImperativeType system: static, weakBased on: ALGOL, Assembly
Designed for system-programming tasks Till 1973 the Unix kernel was written in assembly (PDP-7,
39/57
y ( ,11)
Philosophy:Simple language => simple compilerMany language constructs are based on machine instructionsFine-grain control over memory, I/OMinimal run-time support
1973- First Robust implementation1978- ”The C Programming Language” (AKA: K&R)
The de-facto standardNo type checking of parametersOld style: int main(argc, argv)
int argc; char **argv; { ... }
40/57
1983- C's ANSI standard committee formed1988- 2nd edition published1989- ANSI standard ratified (AKA: C89)
function prototypesvoid pointers/functions, enum types
1990- ANSI C adopted by ISOAKA: C90 ( == C89)
Designers: Alan Kay, Dan Ingalls, Adele GoldbergParadigm: Object-orientedType system: dynamic, strongBased on: Simula, Lisp
Philosophy:Everything is an object
41/57
Everything is an objectProgram is a data structure in memory
The program can examine/modify itselfThree primitive constructs:
send a message to a receiverreturn a valueassign a value to a variable
Class: CookieMonsterSuperclass: MonsterCategory: Sesame Street
42/57
Instance variables: state hunger
nag| item |item := self askForCookie.(item isKindOf: Cookie) ifTrue: [self eat: item]ifFalse: [self complainAbout: item].
7/12/2007
8
Designers: Alain ColmerauerParadigm: Logic programmingType system: varies
Designed for AI tasks (searching in trees/graphs) Philosophy:
A rule defines an implication (right implies left)
43/57
A rule defines an implication (right implies left) Predicate – A set of rules with the same left-hand side termPredicate invocation:
Returns all tuples matching the value passed-in
pred('Washington', 'Adams').pred('Adams', 'Jefferson').pred('Jefferson', 'Madison').pred('Madison', 'Monroe').pred('Monroe', 'Adams').
before(X,Z) :- pred(X,Z).before(X,Z) :- pred(X,Y), before(Y,Z).
44/57
( , ) p ( , ), ( , )
before(A,'Madison')?<'Jefferson'><'Adams'><'Washington'>
Designer: Robin MilnerParadigm: FunctionalType system: static, strong, inferred
A functional language w/ static type checkingLisp is functional but dynamically typedNot purely functional => Allows side effects
45/57
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;
Large scale programs are hereLanguage features for coping with the complexity of the code
46/57
Designer: Jean Ichbiah, S. Tucker TaftParadigm: ImperativeType system: static, strongBased on: Algol 68, Pascal
Developed for the US Department of DefenceRequirements
47/57
RequirementsModular, safe, high level of abstractionHigh maintainabilityShould replace ad-hoc hardware-dependent languages
Frequent in embedded systems
function fib(n : integer) return integer isf : integer := 0;s : integer := 1;tmp : integer;
beginfor i in 1..n loop
tmp := f + s;f := s;
48/57
f : s;s := tmp;
end loop;return f;
end fib;
7/12/2007
9
Designed using the ”waterfall” approachThe same design procedure as in weapon systems
1975- Working group for a new computer language formed1977- Ideal language specification, ”Ironman”, published1979- The Green proposal is chosen1980- Ada's reference manual approved
49/57
1980 Ada s reference manual approved 1983- First implementation validated
+ Ada becomes an ANSI standard1987- DoD adopts the Ada mandate
Requires the use of Ada in projects with > 30% new code1997- DoD adopts the COTS policy
Commercial Off-The-Shelf technologies
Designer: Bjarne StroustrupParadigm: Object-orientedType system: static, weakBased on: C, Simula
Philosophy: C's performance
50/57
C s performanceSimula's features
Three major stages: 1985, 1989, 1998 (First standard) Next version: C++0x (...Hopefully x <= 9)
Drawbacks: C, poor standard library, no GC
51/57
Designer: Bertrand Meyer Paradigm: Object-orientedType system: static, strongBased on: Simula, Ada
Software Engineering orientedDesign by Contract
52/57
Design by ContractAutomatic documentation
fib (n: INTEGER): INTEGER isrequire -- Design By Contract:pre_fib: n > 0 -- Precondition
local i, tmp, f, s: INTEGER
do from
f := 0; s := 1; i := 1;
53/57
until i = n;
loop tmp := f + s; f := s; s := tmp; i = i + 1;
end; Result := s;
end;
Performance is less of a problem
Hybrid software systemsInteroperabilityRapid prototyping
54/57
The Internet Web serversBrowser-side programsAccessibility to open source libraries
7/12/2007
10
Designer: Simon Peyton-Jones, Paul Hudak, Philip WadlerParadigm: FunctionalType system: static, strong, inferredBased on: ML, Miranda
Philosophy: Purely functionalNo side effects (unless you ask nicely)
55/57
No side effects (unless you ask nicely)
module Main whereimport System.Environment
fib = 1 : 1 : zipWith (+) fib (tail fib)
main = doargs <- getArgsprint (fib !! (read(args!!0)-1))
56/57
2D grammarLazy evaluation: fib is recursive but has no if'sdo construct for sequential executionType inference
print (fib !! (read(args!!0) 1))
Designer: James GoslingParadigm: Object-orientedType system: static, strongBased on: C++, Smalltalk, Eiffel
PhilosophyCompile once run anywhere
57/57
Compile once run anywhereSafe yet dynamic (applets) =>Internet ready!
As of 2006, mostly open sourced (!)
Is Java's popularity due its OO nature?
Powerful runtime systemJVM, JIT, GC
A huge standard libraryN t ki JDBC GUI Th di C t h
58/57
Networking, JDBC, GUI, Threading, Cryptography, ...
Enterprise Applications J2EE, hotswapping
Unicode
59/57
Interpreters: The Resurrection
60/57
e p e e s: e esu ec o
7/12/2007
11
Interpreters: The Resurrection
61/57
e p e e s: e esu ec oComing soon to an IDE near you
1987- Perl1990- Python1991- Visual Basic1995- Ruby1995- Javascript
62/57
1995 Javascript1997- PHP
=> 2005- Ajax
Designer: Yukihiro MatsumotoParadigm: Object-orientedType system: dynamic, strongBased on: Smalltalk, Lisp, Python
Philosophy: ”programmer productivity and fun”
63/57
HighlightsImplicit declaration of setter, gettersMixings, open classes/objectsRoR: Ruby-on-Rails
Framework for DB-based web application
class Someonedef initialize(name)
@name = name end
end
b S ("B t")
64/57
b = Someone.new("Bart")
# puts b.name # Error: undefined method 'name'
class Someone attr_accessor :name
end
puts b.name # Output: 'Bart'
Designer: Rasmus LerdorfParadigm: ImperativeType system: dynamic, strongBased on: C, Perl
HighlightsServer side scripting
65/57
Server side scriptingHTML text embedded within the source codePHP = PHP: Hypertext Preprocessor
<b>Server<?phpecho ' Side '?>Scripting</b>
.
.
.</languages><IDEs abridged>
66/57
<IDEs.abridged>...
7/12/2007
12
1976-VI
67/57
1976-Emacs
68/57
1986-GDB
69/57
1987-Turbo Pascal 4
70/57
1991-XEmacs
71/57
1994-DDD
72/57
7/12/2007
13
1996-Squeak
73/57
2002-Visual Studio .NET
74/57
2007-Eclipse 3.2.2
75/57
.
.
.</IDEs.abridged><conclusions>
76/57
<conclusions>...
ProductivityPerformance
77/57
Seems to be decided in favor of productivity
Machine codeVirtual machineInterpreter
78/57
p
Strongly related to the question of portability...
7/12/2007
14
1) Machine specific languages: AssemblyAlmost no portability
2) Compiler + O/S isolate from hardware: Algol, CSource compatibility on same O/S
79/57
Binary compatibility on same O/S & CPU
3) Comprehensive standard libraries: EiffelSource compatibility on all platforms
4) Virtual machine: Java, SmalltalkFull source + binary compatibility
StaticDynamic
80/57
Currently, the hottest debateManifested by the ”performance is not an issue” claim
FunctionalImperative
81/57
A 71-years old debate
No absolute answer
Too many contradicting factorsToo many players (languages)
Very easy to produce a new language
82/57
Extremely difficult to measure the marketStill, here are a few attempts...
83/57Source: http://www.cs.berkeley.edu/~flab/languages.html 84/57Source: http://radar.oreilly.com/archives/2007/03/programming_lan.html
7/12/2007
15
85/57Source: http://www.tiobe.com/index.htm?tiobe_index 86/57Source: April 2005 data of http://www.tiobe.com
Software is cheaper the Hardware(to a certain degree)
A researcher can easily develop new language constructs=> Wealth of languages
87/57
Compared to hardware technologiesEach making one small step forward
=> Languages evolveIt is hard to detect the major trends
http://www.cs.fit.edu/~ryan/ada/ada-hist.htmlhttp://www.tiobe.com/index.htm?tiobe_indexhttp://radar.oreilly.com/archives/2007http://thomer.com/vi/vi.htmlhttp://www.squeak.org/Smalltalk/http://acs.ucsd.edu/info/dbx.debug.php
88/57
http://www.research.att.com/~bs/homepage.htmlhttp://pascalprogramming.byethost15.comhttp://www.levenez.com/lang/history.htmlhttp://en.wikipedia.orghttp://st-www.cs.uiuc.edu/balloon.htmlhttp://www.sppn.nl/logo.html
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_languages
http://www whitehouse gov/history/presidents/chronological ht
89/57
http://www.whitehouse.gov/history/presidents/chronological.html
http://www.dcs.ed.ac.uk/home/stg/NOTES/node59.html
.
.
.</conclusions>
</lecture>
90/57
</lecture>
7/12/2007
16
91/57