software ideals and history bjarne stroustrup

38
Software ideals and Software ideals and history history Bjarne Stroustrup Bjarne Stroustrup www.stroustrup.com/ www.stroustrup.com/ Programming Programming

Upload: stephanie-forbes

Post on 26-Mar-2015

247 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software ideals and history Bjarne Stroustrup

Software ideals and historySoftware ideals and history

Bjarne StroustrupBjarne Stroustrupwww.stroustrup.com/Programmingwww.stroustrup.com/Programming

Page 2: Software ideals and history Bjarne Stroustrup

OverviewOverview IdealsIdeals

Aims, heroes, techniquesAims, heroes, techniques Languages and language designersLanguages and language designers

Early languages to C++Early languages to C++

(There is so much more than(There is so much more thanwhat we can cover)what we can cover)

33Stroustrup/ProgrammingStroustrup/Programming

Page 3: Software ideals and history Bjarne Stroustrup

History and ideasHistory and ideas

One opinionOne opinion History is bunkHistory is bunk

Another opinionAnother opinion He who does not know history is condemned to repeat itHe who does not know history is condemned to repeat it

Our viewOur view There can be There can be no professionalism without historyno professionalism without history

If you know too little of the background of your field you are If you know too little of the background of your field you are gulliblegullible

History is littered with plausible ideas that didn’t workHistory is littered with plausible ideas that didn’t work ““I have a bridge I’d like to sell you”I have a bridge I’d like to sell you”

Ideas and ideals are crucial for practical useIdeas and ideals are crucial for practical use And they are the real “meat” of historyAnd they are the real “meat” of history

44Stroustrup/ProgrammingStroustrup/Programming

Page 4: Software ideals and history Bjarne Stroustrup

What is a programming language?What is a programming language? A tool for instructing machinesA tool for instructing machines A notation for algorithmsA notation for algorithms A means for communication among programmersA means for communication among programmers A tool for experimentationA tool for experimentation A means for controlling computer-controlled gadgetsA means for controlling computer-controlled gadgets A means for controlling computerized devicesA means for controlling computerized devices A way of expressing relationships among conceptsA way of expressing relationships among concepts A means for expressing high-level designsA means for expressing high-level designs

All of the above!All of the above! And moreAnd more

55Stroustrup/ProgrammingStroustrup/Programming

Page 5: Software ideals and history Bjarne Stroustrup

Greek heroesGreek heroes

Every culture and profession must have ideals and heroesEvery culture and profession must have ideals and heroes Physics: Newton, Einstein, Bohr, FeynmanPhysics: Newton, Einstein, Bohr, Feynman Math: Euclid, Euler, HilbertMath: Euclid, Euler, Hilbert Medicine: Hippocrates, Pasteur, FlemingMedicine: Hippocrates, Pasteur, Fleming

66Stroustrup/ProgrammingStroustrup/Programming

Page 6: Software ideals and history Bjarne Stroustrup

Geek heroesGeek heroes

Brian KernighanBrian Kernighan Programmer and writer Programmer and writer

extraordinaireextraordinaire

77

Dennis RitchieDennis Ritchie Designer and original Designer and original

implementer of Cimplementer of C

Stroustrup/ProgrammingStroustrup/Programming

Page 7: Software ideals and history Bjarne Stroustrup

Another geek heroAnother geek hero

Kristen NygaardKristen Nygaard Co-inventor (with Ole-Co-inventor (with Ole-

Johan Dahl) of Simula67 Johan Dahl) of Simula67 and of object-oriented and of object-oriented Programming and Programming and object-oriented designobject-oriented design

88Stroustrup/ProgrammingStroustrup/Programming

Page 8: Software ideals and history Bjarne Stroustrup

Yet another geek heroYet another geek hero

Alex StepanovAlex Stepanov Inventor of the STL and Inventor of the STL and

generic programming generic programming pioneerpioneer

99Stroustrup/ProgrammingStroustrup/Programming

Page 9: Software ideals and history Bjarne Stroustrup

Two extremesTwo extremes

Academic beauty/perfection/purityAcademic beauty/perfection/purity Commercial expediencyCommercial expediency

The pressures towards both are immenseThe pressures towards both are immense Both extremes must be avoided for serious progress to occurBoth extremes must be avoided for serious progress to occur

Both extremes encourage overstatement of results (hype) and Both extremes encourage overstatement of results (hype) and understatement (or worse) of alternatives and ancestor languagesunderstatement (or worse) of alternatives and ancestor languages

1010Stroustrup/ProgrammingStroustrup/Programming

Page 10: Software ideals and history Bjarne Stroustrup

IdealsIdeals

The fundamental aims of good designThe fundamental aims of good design Represent ideas directly in codeRepresent ideas directly in code Represent independent ideas independently in codeRepresent independent ideas independently in code Represent relationships among ideas directly in codeRepresent relationships among ideas directly in code Combine ideas expressed in code freelyCombine ideas expressed in code freely

where and only where combinations make sense where and only where combinations make sense From these followFrom these follow

CorrectnessCorrectness MaintainabilityMaintainability PerformancePerformance

Apply these to the widest possible range of Apply these to the widest possible range of applicationsapplications

1111Stroustrup/ProgrammingStroustrup/Programming

Page 11: Software ideals and history Bjarne Stroustrup

Ideals have practical usesIdeals have practical uses

During the start of a project, reviews them to get ideasDuring the start of a project, reviews them to get ideas When you are stuck late at night, step back and see When you are stuck late at night, step back and see

where your code has most departed from the ideals – where your code has most departed from the ideals – this is where the bugs are most likely to lurk and the this is where the bugs are most likely to lurk and the design problems are most likely to occurdesign problems are most likely to occur Don’t just keep looking in the same place and trying the Don’t just keep looking in the same place and trying the

same techniques to find the bugsame techniques to find the bug ““The bug is always where you are The bug is always where you are notnot looking – or you would have looking – or you would have

found it already”found it already”

1212Stroustrup/ProgrammingStroustrup/Programming

Page 12: Software ideals and history Bjarne Stroustrup

Ideals are personalIdeals are personal Chose yours wellChose yours well

1313Stroustrup/ProgrammingStroustrup/Programming

Page 13: Software ideals and history Bjarne Stroustrup

Styles/paradigmsStyles/paradigms Procedural programmingProcedural programming Data abstractionData abstraction Object-oriented programmingObject-oriented programming Generic programmingGeneric programming

Functional programming, Logic programming, rule-Functional programming, Logic programming, rule-based programming, constraints-based programming, based programming, constraints-based programming, aspect-oriented programming, …aspect-oriented programming, …

1414Stroustrup/ProgrammingStroustrup/Programming

Page 14: Software ideals and history Bjarne Stroustrup

Styles/paradigmsStyles/paradigmstemplate<class Iter> void draw_all(Iter b, Iter e)template<class Iter> void draw_all(Iter b, Iter e)

{{

for_each(b,e,mem_fun(&Shape::draw)); // for_each(b,e,mem_fun(&Shape::draw)); // draw all shapes in [b:e)draw all shapes in [b:e)

}}

Point p(100,100);Point p(100,100);

Shape* a[] = { new Circle(p,50), new Rectangle(p, 250, 250) };Shape* a[] = { new Circle(p,50), new Rectangle(p, 250, 250) };

draw_all(a,a+2);draw_all(a,a+2);

Which programming styles/paradigms did we use here?Which programming styles/paradigms did we use here? Procedural, data abstractions, OOP, and GPProcedural, data abstractions, OOP, and GP

1515Stroustrup/ProgrammingStroustrup/Programming

Page 15: Software ideals and history Bjarne Stroustrup

Some fundamentalsSome fundamentals Portability is goodPortability is good Type safety is goodType safety is good High performance is goodHigh performance is good Anything that eases debugging is goodAnything that eases debugging is good Access to system resources is goodAccess to system resources is good Stability over decades is goodStability over decades is good Ease of learning is goodEase of learning is good Small is goodSmall is good Whatever helps analysis is goodWhatever helps analysis is good Having lots of facilities is goodHaving lots of facilities is good

You can’t have all at the same time: engineering tradeoffsYou can’t have all at the same time: engineering tradeoffs

1616Stroustrup/ProgrammingStroustrup/Programming

Page 16: Software ideals and history Bjarne Stroustrup

Programming languagesProgramming languages

Machine codeMachine code Bits, octal, or at most decimal numbersBits, octal, or at most decimal numbers

AssemblerAssembler Registers, load, store, integer add, floating point add, …Registers, load, store, integer add, floating point add, … Each new machine had its own assemblerEach new machine had its own assembler

Higher level languagesHigher level languages First: Fortran and COBOLFirst: Fortran and COBOL

Rate of language inventionRate of language invention At least 2000 a decadeAt least 2000 a decade

Major languages todayMajor languages today Really solid statistics are hard to come byReally solid statistics are hard to come by

IDS: about 9 million professional programmersIDS: about 9 million professional programmers COBOL, Fortran, C, C++, Visual Basic, PERL, Java, JavascriptCOBOL, Fortran, C, C++, Visual Basic, PERL, Java, Javascript

Ada, C#, PHP, …Ada, C#, PHP, …

1717Stroustrup/ProgrammingStroustrup/Programming

Page 17: Software ideals and history Bjarne Stroustrup

Early programming languagesEarly programming languages

1818

Classic C

Simula

Pascal

Algol68

BCPL

Fortran

Lisp

COBOL

Algol60

PL\1

1950s: 1960s: 1970s:

Red==major commercial useYellow==will produce important “offspring”

Stroustrup/ProgrammingStroustrup/Programming

Page 18: Software ideals and history Bjarne Stroustrup

Modern programming languagesModern programming languages

1919

Object Pascal

C++

Java95

C#Ada98

C++98

Java04

C++0x

PythonLispSmalltalk

Fortran77

Ada

EiffelSimula67

COBOL89

PHP

C89

Pascal

PERLVisual Basic

COBOL04 Javascript

Stroustrup/ProgrammingStroustrup/Programming

Page 19: Software ideals and history Bjarne Stroustrup

Why do we design and evolve languages?Why do we design and evolve languages?

There are many diverse applications areasThere are many diverse applications areas No one language can be the best for everythingNo one language can be the best for everything

Programmers have diverse backgrounds and skillsProgrammers have diverse backgrounds and skills No one language can be best for everybodyNo one language can be best for everybody

Problems changeProblems change Over the years, computers are applied in new areas and to new problemsOver the years, computers are applied in new areas and to new problems

Computers changeComputers change Over the decades, hardware characteristics and tradeoffs changeOver the decades, hardware characteristics and tradeoffs change

Progress happensProgress happens Over the decades, we learn better ways to design and implement Over the decades, we learn better ways to design and implement

languageslanguages

2020Stroustrup/ProgrammingStroustrup/Programming

Page 20: Software ideals and history Bjarne Stroustrup

First modern computer – first compilerFirst modern computer – first compiler

David WheelerDavid Wheeler University of CambridgeUniversity of Cambridge Exceptional problem solver: hardware, software, algorithms, librariesExceptional problem solver: hardware, software, algorithms, libraries First computer science Ph.D. (1951)First computer science Ph.D. (1951) First paper on how to write correct, reusable, and maintainable code (1951)First paper on how to write correct, reusable, and maintainable code (1951) (Thesis advisor for Bjarne Stroustrup (Thesis advisor for Bjarne Stroustrup ))

2121Stroustrup/ProgrammingStroustrup/Programming

Page 21: Software ideals and history Bjarne Stroustrup

Early languages – 1952Early languages – 1952 One language for each machineOne language for each machine

Special features for processorSpecial features for processor Special features for “operating system”Special features for “operating system” Most had very assembler-like facilitiesMost had very assembler-like facilities

It was easy to understand which instructions would be generatedIt was easy to understand which instructions would be generated

No portability of codeNo portability of code

2222Stroustrup/ProgrammingStroustrup/Programming

Page 22: Software ideals and history Bjarne Stroustrup

FortranFortran

John BackusJohn Backus IBMIBM FORTRAN, the first high level computer language to be developed. FORTRAN, the first high level computer language to be developed.

We did not know what we wanted and how to do it. It just sort of grew. We did not know what we wanted and how to do it. It just sort of grew. The Backus-Naur Form (BNF), a standard notation to describe the The Backus-Naur Form (BNF), a standard notation to describe the

syntax of a high level programming language. syntax of a high level programming language. A functional programming language called FP, which advocates a A functional programming language called FP, which advocates a

mathematical approach to programmingmathematical approach to programming..

2323Stroustrup/ProgrammingStroustrup/Programming

Page 23: Software ideals and history Bjarne Stroustrup

Fortran – 1956Fortran – 1956 Allowed programmers to write linear algebra much as they Allowed programmers to write linear algebra much as they

found it in textbooksfound it in textbooks Arrays and loopsArrays and loops Standard mathematical functionsStandard mathematical functions

librarieslibraries Users’ own functionsUsers’ own functions

The notation was largely machine independentThe notation was largely machine independent Fortran code could often be moved from computer to computer with Fortran code could often be moved from computer to computer with

only minor modificationonly minor modification This was a This was a hugehuge improvement improvement

Arguably the largest single improvement in the history of Arguably the largest single improvement in the history of programming languagesprogramming languages

Continuous evolution: II, IV, 77, 90, 0xContinuous evolution: II, IV, 77, 90, 0x

2424Stroustrup/ProgrammingStroustrup/Programming

Page 24: Software ideals and history Bjarne Stroustrup

COBOLCOBOL ““Rear Admiral Dr. Grace Murray Hopper (US Rear Admiral Dr. Grace Murray Hopper (US

Navy) was a remarkable woman who grandly Navy) was a remarkable woman who grandly rose to the challenges of programming the first rose to the challenges of programming the first computers. During her lifetime as a leader in computers. During her lifetime as a leader in the field of software development concepts, she the field of software development concepts, she contributed to the transition from primitive contributed to the transition from primitive programming techniques to the use of programming techniques to the use of sophisticated compilers. She believed that sophisticated compilers. She believed that ‘we've always done it that way’ was not ‘we've always done it that way’ was not necessarily a good reason to continue to do so.” necessarily a good reason to continue to do so.”

2525Stroustrup/ProgrammingStroustrup/Programming

Page 25: Software ideals and history Bjarne Stroustrup

Cobol – 1960Cobol – 1960 Cobol was (and sometimes still is) for business programmers Cobol was (and sometimes still is) for business programmers

what Fortran was (and sometimes still is) for scientific what Fortran was (and sometimes still is) for scientific programmersprogrammers

The emphasis was on data manipulationThe emphasis was on data manipulation CopyingCopying Storing and retrieving (record keeping)Storing and retrieving (record keeping) Printing (reports)Printing (reports)

Calculation/computation was seen as a minor matterCalculation/computation was seen as a minor matter It was hoped/claimed that Cobol was so close to business It was hoped/claimed that Cobol was so close to business

English that managers could program and programmers would English that managers could program and programmers would soon become redundantsoon become redundant

Continuous evolution: 60, 61, 65, 68, 70, 80, 90, 04Continuous evolution: 60, 61, 65, 68, 70, 80, 90, 04

2626Stroustrup/ProgrammingStroustrup/Programming

Page 26: Software ideals and history Bjarne Stroustrup

LispLisp

John McCarthyJohn McCarthy Stanford UniversityStanford University AI pioneerAI pioneer

2727Stroustrup/ProgrammingStroustrup/Programming

Page 27: Software ideals and history Bjarne Stroustrup

Lisp – 1960Lisp – 1960 List/symbolic processingList/symbolic processing Initially (and often still) interpretedInitially (and often still) interpreted Dozens (most likely hundreds) of dialectsDozens (most likely hundreds) of dialects

““Lisp has an implied plural”Lisp has an implied plural” Common LispCommon Lisp SchemeScheme

This family of languages has been (and is) the This family of languages has been (and is) the mainstay of artificial intelligence (AI) researchmainstay of artificial intelligence (AI) research though delivered products have often been in C or C++though delivered products have often been in C or C++

2828Stroustrup/ProgrammingStroustrup/Programming

Page 28: Software ideals and history Bjarne Stroustrup

AlgolAlgol

Peter NaurPeter Naur Danish Technical University and RegnecentralenDanish Technical University and Regnecentralen BNFBNF

Edsger DijkstraEdsger Dijkstra Mathematisch Centrum, Amsterdam, Eindhoven University of Mathematisch Centrum, Amsterdam, Eindhoven University of

Technology, Burroughs Corporation , University of Texas (Austin)Technology, Burroughs Corporation , University of Texas (Austin) Mathematical logic in programming, algorithmsMathematical logic in programming, algorithms THE operating systemTHE operating system

2929Stroustrup/ProgrammingStroustrup/Programming

Page 29: Software ideals and history Bjarne Stroustrup

Algol – 1960Algol – 1960

The breakthrough of modern programming language conceptsThe breakthrough of modern programming language concepts Language descriptionLanguage description

BNF; separation of lexical, syntactic, and semantic concernsBNF; separation of lexical, syntactic, and semantic concerns ScopeScope TypeType The notion of “general purpose programming language”The notion of “general purpose programming language”

Before that languages were either scientific (e.g., Fortran), business (e.g., Before that languages were either scientific (e.g., Fortran), business (e.g., Cobol), string manipulation (e.g., Lisp), simulation, …Cobol), string manipulation (e.g., Lisp), simulation, …

Never reached major non-academic useNever reached major non-academic use

3030

Algol58 Algol60

Simula67

Algol68

PascalStroustrup/ProgrammingStroustrup/Programming

Page 30: Software ideals and history Bjarne Stroustrup

Simula 67Simula 67

Kristen Nygaard and Ole-Johan DahlKristen Nygaard and Ole-Johan Dahl Norwegian Computing CenterNorwegian Computing Center Oslo UniversityOslo University The start of object-oriented programming and object-oriented designThe start of object-oriented programming and object-oriented design

3131Stroustrup/ProgrammingStroustrup/Programming

Page 31: Software ideals and history Bjarne Stroustrup

Simula 1967Simula 1967 Address all applications domains rather then a specific domainAddress all applications domains rather then a specific domain

As Fortran, COBOL, etc. didAs Fortran, COBOL, etc. did Aims to become a true general-purpose programming languageAims to become a true general-purpose programming language

Model real-world phenomena in codeModel real-world phenomena in code represent ideas as classes and class objectsrepresent ideas as classes and class objects represent hierarchical relations as class hierarchiesrepresent hierarchical relations as class hierarchies

Classes, inheritance, virtual functions, object-oriented designClasses, inheritance, virtual functions, object-oriented design A program becomes a set of interacting objects rather than a A program becomes a set of interacting objects rather than a

monolithmonolith Has major (positive) implications for error ratesHas major (positive) implications for error rates

3232Stroustrup/ProgrammingStroustrup/Programming

Page 32: Software ideals and history Bjarne Stroustrup

CC Dennis RitchieDennis Ritchie Bell LabsBell Labs C and helped with UnixC and helped with Unix

Ken ThompsonKen Thompson Bell LabsBell Labs UnixUnix

3333

Doug McIlroyDoug McIlroy Bell LabsBell Labs Everybody’s favorite critic, Everybody’s favorite critic,

discussion partner, and discussion partner, and ideas man (influenced C, ideas man (influenced C, C++, Unix, and much C++, Unix, and much more)more)

Stroustrup/ProgrammingStroustrup/Programming

Page 33: Software ideals and history Bjarne Stroustrup

Bell Labs – Murray HillBell Labs – Murray Hill

3434Stroustrup/ProgrammingStroustrup/Programming

Page 34: Software ideals and history Bjarne Stroustrup

C – 1978C – 1978 (Relatively) high-level programming language for systems (Relatively) high-level programming language for systems

programmingprogramming Very widely used, relatively low-level, weakly typed, systems Very widely used, relatively low-level, weakly typed, systems

programming languageprogramming language Associated with Unix and through that with Linux and the open source Associated with Unix and through that with Linux and the open source

movementmovement Performance becomes somewhat portablePerformance becomes somewhat portable Designed and implemented by Dennis Ritchie 1974-78Designed and implemented by Dennis Ritchie 1974-78

3535

CPL BCPL B

C99

C++

C89

Classic C

C++98

Christopher Strachey, Cambridge, mid-1960s

Martin Richards, Cambridge, 1967

Ken Thompson, BTL, 1972

Stroustrup/ProgrammingStroustrup/Programming

Dennis Ritchie, BTL, 1974

C++0x

Bjarne Stroustrup, BTL, 1985

Page 35: Software ideals and history Bjarne Stroustrup

C++C++

Bjarne StroustrupBjarne Stroustrup AT&T Bell labsAT&T Bell labs Texas A&M UniversityTexas A&M University making abstraction techniques affordable and manageable making abstraction techniques affordable and manageable

for mainstream projects for mainstream projects pioneered the use of object-oriented and generic pioneered the use of object-oriented and generic

programming techniques in application areas where programming techniques in application areas where efficiency is a premium efficiency is a premium

3636Stroustrup/ProgrammingStroustrup/Programming

Page 36: Software ideals and history Bjarne Stroustrup

My ideals – My ideals – in 1980 and still in 2008in 1980 and still in 2008

““To make life easier for the serious programmer”To make life easier for the serious programmer” i.e., primarily me and my friends/colleaguesi.e., primarily me and my friends/colleagues

I love writing codeI love writing code I like reading codeI like reading code I hate debuggingI hate debugging

Elegant and efficient codeElegant and efficient code I really dislike choosing between the twoI really dislike choosing between the two Elegance, efficiency, and correctness are closely related in Elegance, efficiency, and correctness are closely related in

many application domainsmany application domains Inelegance/verbosity is a major source of bugs and inefficienciesInelegance/verbosity is a major source of bugs and inefficiencies

3737Stroustrup/ProgrammingStroustrup/Programming

Page 37: Software ideals and history Bjarne Stroustrup

C++ – 1985C++ – 1985

C++ is a general-purpose programming language C++ is a general-purpose programming language with a bias towards systems programming thatwith a bias towards systems programming that is a better Cis a better C supports data abstractionsupports data abstraction supports object-oriented programmingsupports object-oriented programming supports generic programmingsupports generic programming

3838

Classic C

Simula 67

C++C with Classes

C++98

ARM C++

1979-84

1978-89

1989

Stroustrup/ProgrammingStroustrup/Programming

C++0c

Page 38: Software ideals and history Bjarne Stroustrup

More informationMore information More language designer links/photosMore language designer links/photos

http://www.angelfire.com/tx4/cus/people/http://www.angelfire.com/tx4/cus/people/ A few examples of languages:A few examples of languages:

http://dmoz.org/Computers/Programming/Languages/http://dmoz.org/Computers/Programming/Languages/ TextbooksTextbooks

Michael L. Scott, Michael L. Scott, Programming Language PragmaticsProgramming Language Pragmatics, Morgan , Morgan Kaufmann, 2000, ISBN 1-55860-442-1Kaufmann, 2000, ISBN 1-55860-442-1

Robert W. Sebesta, Robert W. Sebesta, Concepts of programming languagesConcepts of programming languages, , Addison-Wesley, 2003, ISBN 0-321-19362-8Addison-Wesley, 2003, ISBN 0-321-19362-8

History booksHistory books Jean Sammet, Jean Sammet, Programming Languages: History and Programming Languages: History and

FundamentalsFundamentals, Prentice-Hall, 1969, ISBN 0-13-729988-5, Prentice-Hall, 1969, ISBN 0-13-729988-5 Richard L. Wexelblat, Richard L. Wexelblat, History of Programming LanguagesHistory of Programming Languages, ,

Academic Press, 1981, ISBN 0-12-745040-8Academic Press, 1981, ISBN 0-12-745040-8 T. J. Bergin and R. G. Gibson, T. J. Bergin and R. G. Gibson, History of Programming History of Programming

Languages – IILanguages – II, Addison-Wesley, 1996, ISBN 0-201-89502-1, Addison-Wesley, 1996, ISBN 0-201-89502-1

3939Stroustrup/ProgrammingStroustrup/Programming