326x Filetype PDF File size 0.08 MB Source: plg.uwaterloo.ca
A"short"history"of""
programming"languages"
• 1940sB50s:"""
– Programming"is"done"directly"in"machine"language"and"(later)"
A"few"notes"on"C++"and" assembly"language"
programming"languages" • 1950s:""
– First"“high"level"languages”:"FORTRAN,"LISP,"and"COBOL"
Supplementary"notes" • All"are"sUll"in"common"use!"
• FORTRAN"designed"for"science,"LISP"(Scheme/Racket)"for"CS,"COBOL"for"
" business"
CS246"Fall"2012" • 1960s:""
Mike"Godfrey" – First"aXempt"to"define"clean,"abstract"imperaUve"languages"
• esp."Algol,"which"has"many"descendents"(Pascal,"Turing)"
– First"objectBoriented"language:"Simula67"(for"simulaUons)"
A"short"history"of"" A"short"history"of""
programming"languages" programming"languages"
• Early"1970s,"on"big"UmeBsharing"computers:" • Meanwhile,"in"the"late"1970s"on"the"first"micros:"
– C"and"Unix"coBdeveloped"at"AT&T"Bell"labs" – BASIC"(designed"in"1960s,"but"came"into"use"in"1970s)"
• Kernighan,"Ritchie,"Thompson,"…" – Small,"simple"procedural"language"designed:"
– C"is"a"breakthrough!"(as"is"Unix)" • to"be"very"easy"to"learn"
• Can"write"very"efficient"code"directly" • to"run"on"small"computers,"small"RAM,"slow"chip"
• Can"think"of"C"as"being"reasonably"portable"highBlevel"assembly" – Usually"interpreted,"not"compiled"
language" – A"breakthrough"is"the"burgeoning"new"micro"market"of"the"late"
1970s"(pre"IBMBPC/Microsoe),"esp."games"
– C"is"a"simple"but"very"powerful"language,"but" • Altair,"Apple"][,"Commodore"PET,"TRSB80,"etc"
• No"support"for"userBdefined"higherBlevel"abstracUons" • Microsoe’s"first"product"was"a"BASIC"interpreter"wriXen"largely"by"Bill"
• Very"easy"to"make"hardBtoBfind"bugs" Gates"and"Paul"Allen"…"they"had"to"buy"an"OS"(QDOS)"from"someone"
else"when"IBM"wanted"something"to"run"on"their"new"PC"
A"short"history"of"" A"short"history"of""
programming"languages" programming"languages"
• Early"1980s:"" • Early"1990s:"
– C++"at"AT&T"Bell"labs"[Stroustrup]" – Java"at"Sun"Microsystems"[Gosling]"
• ASNI"std"1998,"updated"2003,"C++0X"coming"real"soon"now"
– Create"a"powerful"and"efficient"OO"language"" – Idea:""
• …"that"is"backward"compaUble"with"ANSI"C"(unlike"ObjecUveC)" • OO"language"that"will"work"“everywhere”"
• Can"roll"your"own"strongly"typed"abstracUons!" • Take"best"ideas"of"C++,"remove"complicated"and"error"prone"features"
• Built"on"experience"with"other"OO"langs"(Simula,"Smalltalk)" • Remove"many"lowBlevel"decisions"from"programmer"
– C++"is"a"big,"powerful,"and"very"complicated"language" – Portability"is"achieved"through"a"“virtual"machine”,"like"a"
• It's"the"Swiss"army"knife"of"OOP" special"OS"that"sits"on"top"of"the"real"OS"
• WriUng"a"good"compiler"for"it"is"very,"very"hard" • Need"to"port"the"VM"to"mulUple"plaqorms,"but"only"once"
• Most"programmers"use"only"a"subset"of"the"features" – …"no"need"to"port"the"applicaUon"code"
• “Shoot"yourself"in"the"foot"less"oeen"…"but"…”" – Java"programs"should"work"the"same"on"any"VM"
• But"performance"is"always"a"concern"with"virtualizaUon"
A"short"history"of"" A"short"history"of""
programming"languages" programming"languages"
• Late"1990s:" • Industrial"programming"today:"
– Microsoe".NET"and"C#" – Old"days:""design"a"monolithic"system"to"run"on"top"of"a"
• Roughly,"try"to"do"the"same"thing"as"Java,"but"with"several"years"of" desired"OS"on"parUcular"hardware"
hindsight"and"experience"in"watching"Java" – These"days:""Design"a"piece"of"a"component"that"interacts"
– Emergence"of"the"idea"of"plaqorm"/"framework"as"the" with"a"bunch"of"other"peer"components"across"various"
deployment"target,"not"the"raw"OS"and"hardware" networks"and""the"cloud""
• Underlying"OS"is"(mostly)"irrelevant!"
• J2EE,"web"services,"CGIs,"scripUng"langs,"SOA"
• InteracUon"is"assumed"via"APIs,"services,"XML,"hXp"
ScripUng"languages:"" We’re"going"to"study"C++"cos"…"
Python,"Perl,"PHP,"BASH,"and"friends"
• The"C/C++/Java"memory"model"dominates"all"others"in"
• In"the"old"days:" industry""
– Monolithic"programs"did"heavy"lieing"
– CoBordinaUon"/"interacUon"is"ad"hoc,"oeen"using"“shell"scripts”"to" • C++"supports"full"objectBbased"and"objectBoriented"styles"
move"files"around,"start"processes,"etc" of"programming"(as"does"Java)"
• These"days,"scripUng"languages"are"much"more"powerful," • C++"is,"roughly"speaking,"a"superset"of"C,"so"it’s"less"
support"OO"and"modules" stress"for"you"to"learn"
– Easy"to"create"small"to"medium"sized"programs"(<100"KLOC)"
• Much"of"the"game"CivilizaUon"is"in"Python!" • C++"supports"lots"of"interesUng"language"design"features"
– But"are"typically"weakly"typed"(hard"to"debug)"and"slow"…" – Raw"pointers,"mulUple"inheritance,"templates"
– They"are"popular"because"many"“scriptBlike”"tasks"can"be"done"much" – Java"has"limited"or"so"support"for"these"by#design#
more"quickly"and"simply"than"a"tradiUonal"HLL"like"C"or"Java."
What"you"have"seen"so"far" Some"free"advice"
• CS136"(or"similar)" • General"rules"of"thumb"for"C++"programming:"
– Basic"C"programs,"CBlike"syntax"(for"loops),"compiling" – Find"a"set"of"basic"language"features"that"get"you"
C"in"Unix"with"gcc" where"you"want"to"go,"and"use"those"
• “There’s"more"than"one"way"to"do"it”"is"a"terrible"way"to"
• C++"this"term" design"a"language"(Perl)"
– Hello"world,"compiling"in"Unix"with"g++" – Stay"away"from"complex,"subtle,"powerful,"“cool”"
– Basic"types,"int"vs"double,"[file/formaxng]"IO" features"as"they"will"make"your"life"difficult"in"the"long"
– FuncUons,"decls,"params,"locals,"callBbyBref/value," term"
overloading"
– Arrays"[are"evil;"pls"use"vectors]" e.g,,"comma"operator,"mulUple"inheritance"
– Classes/structs"[they’re"the"same"in"C++**]" But"learn"how"to"use"them"judiciously"later"on"
"
Some"free"advice" Some"free"advice"
• Always"use"curly"brackets"for"if/switch/for/ • struct"or"class?"
while bodies,"even"if"they"are"only"one"liners" – If"you’re"going"to"program"in"a"procedural"style"and"
• Use"++,"BB"operators"as"a"standalone"stmt,"not"part"of" not"define"methods"per"enUty"kind,"then"use"
some"long"expression" structs"to"organize"you"data"
– If"you’re"going"to"program"in"an"OO"style"and"define"
• Prefer"for"over"while"for"loops,"if"a"for"“makes" methods"per"enUty"kind,"then"use"classes"to"
sense”" organize"your"data"and"operaUons"on"them"
for (int i=0; i
no reviews yet
Please Login to review.