1
1 CS2110 Spring 2015. Concluding Lecture: History, Correctness Issues, Summary Final review session: Fri, 12 Dec. 1:00–3:00. Room TBA. Final: 2:00–4:30PM, Tuesday, 16 Dec, Barton Hall We hope to get you tentative course grades by Tuesday noon, but it may be later. You then visit the CMS and do the assignment to tell us whether you accept the grade or will take the final. There will be a message on the Piazza and the CMS about this when the tentative course grades are available.

2
2 About the Final Final review session: Fri, 12 Dec. 1:00–3:00. Room TBA. Final: 2:00–4:30PM, Tuesday, 16 Dec, Barton Hall Walk into final room, you must complete the final. E.g. You may not decide half way through the final that you don’t want to take it. A few students missed one of the two prelims. These students are required to take the final unless other ar- rangements have been made. Taking final may lower/raise your course grade. Past experience: taking final changes letter grade for very few —fewer than 10 in a course of 200, mostly raises.

4
4 CS2110 Spring 2014. Concluding Lecture: History, Correctness Issues, Summary Programming and computers: Momentous changes since the 1940s –or since even the use of punch cards and attempt at automation …

5
5 Punch cards Mechanical loom invented by Joseph Marie Jacquard in 1801. Used the holes punched in pasteboard punch cards to control the weaving of patterns in fabric. Punch card corresponds to one row of the design. Based on earlier invention by French mechanic Falcon in 1728. Jacquard loom Loom still used in China

6
6 Charles Babbage designed a “difference engine” in 1822 Compute mathematical tables for log, sin, cos, other trigonometric functions. The mathematicians doing the calculations were called computers No electricity

7
7 Oxford English Dictionary, 1971 Computer: one who computes; a calculator, rekoner. spec. a person employed to make calculations in an observatory, in surveying. etc. 1664: Sir T. Browne. The calendars of these computers. 1704. T. Swift. A very skillful computer. 1744. Walpole. Told by some nice computers of national glory. 1855. Brewster Newton. To pay the expenses of a computer for reducing his observations. The mathematicians doing the calculations were called computers

8
8 Charles Babbage planned to use cards to store programs in his Analytical engine. (First designs of real computers, middle 1800s until his death in 1871.) First programmer was Ada Lovelace, daughter of poet Lord Byron. Privately schooled in math. One tutor was Augustus De Morgan. The Right Honourable Augusta Ada, Countess of Lovelace.

9
9 Herman Hollerith. His tabulating machines used in compiling the 1890 Census. Hollerith's patents were acquired by the Computing-Tabulating-Recording Co. Later became IBM. The operator places each card in the reader, pulls down a lever, and removes the card after each punched hole is counted. Hollerith 1890 Census Tabulator

14
14 1960: Big Year for Programming Languages LISP (List Processor): McCarthy, MIT (moved to Stanford). First functional programming language. No assignment statement. Write everything as recursive functions. COBOL (Common Business-Oriented Language). Became most widely used language for business, data processing. ALGOL (Algorithmic Language). Developed by an international team over a 3-year period. McCarthy was on it, John Backus was on it (developed Fortran in mid 1950’s). Gries’s soon-to-be PhD supervisor, Fritz Bauer of Munich, led the team.

16
16 Late 1960s IBM 360 Mainframes Write programs on IBM “punch cards. Deck of cards making up a program trucked to Langmuir labs by the airport 2-3 times a day; get them back, with output, 3-4 hours later

18
18 1983-84 Switched to Macintosh in labs 1980s CS began getting computers on their desks. Late 1980s Put fifth floor addition on Upson. We made the case that our labs were in our office and therefore we need bigger offices. Nowadays Everybody has a computer in their office. 2014 Moved into Gates Hall!

20
The NATO Software Engineering Conferences homepages.cs.ncl.ac.uk/brian.randell/NATO/ 7-11 Oct 1968, Garmisch, Germany 27-31 Oct 1969, Rome, Italy Download Proceedings, which have transcripts of discussions. See photographs. Software crisis: Academic and industrial people. Admitted for first time that they did not know how to develop software efficiently and effectively.

23
During 1970s, 1980s, intense research on How to prove programs correct, How to make it practical, Methodology for developing algorithms 23 The way we understand recursive methods is based on that methodology. Our understanding of and development of loops is based on that methodology. Throughout, we try to give you thought habits and strategies to help you solve programming problems for effectively, e.g. Write good method specs. Keep methods short. Use method calls to eliminate nested loops. Put local variable declarations near first use. Mark Twain: Nothing needs changing so much as the habits of others.

24
24 The way we understand recursive methods is based on that methodology. Our understanding of and development of loops is based on that methodology. Throughout, we try to give you thought habits to help you solve programming problems for effectively Simplicity is key: Learn not only to simplify, learn not to complify. Separate concerns, and focus on one at a time. Don’t solve a problem until you know what the problem is (give precise and thorough specs). Develop and test incrementally. Learn to read a program at different levels of abstraction. Use methods and method calls so that you don’t have nested loops

25
25 Simplicity and beauty: keys to success CS professor's non-dilemma I do so want students to see beauty and simplicity. A language used just has to be one only with that property. Therefore, and most reasonably, I will not and do not teach C. David Gries CS has its field of computational complexity. Mine is computational simplicity, David Gries Inside every large program is a little program just trying to come out. Tony Hoare Beauty is our Business. Edsger Dijkstra Admonition a little Grook In correctness concerns one must be immersed. To use only testing is simply accursed.

26
We try to instil good programming habits/ thoughts 26 Write method specs before writing the body Write new methods and calls on them to keep structure simple and to shorten methods for… if … for … while … if … else for … And yet, we see 100 line methods that look like this, with no comments: Keep case analysis to a minimum if (d == Direction.E) … if (d == Direction.NE) … if (d == Direction.N) … …

27
Correctness of programs, the teaching of programming 27 simplicity elegance perfection intellectual honesty Dijkstra: The competent programmer is fully aware of the limited size of his own skull, so he approaches the programming task in full humility, and among other things, he avoids clever tricks like the plague. Hoare: Two ways to write a program: (1) Make it so simple that there are obviously no errors. (2) Make it so complicated that there are no obvious errors. Edsger W. Dijkstra Sir Tony Hoare

28
Axiomatic Basis for Computer Programming. Tony Hoare, 1969 28 Provide a definition of programming language statements not in terms of how they are executed but in terms of proving them correct. {precondition P} Statement S {Postcondition Q) Meaning: If P is true, then execution of S is guaranteed to terminate and with Q true

31
If statement defined as an “inference rule”: 31 Definition of if statement: If Then {P} if (B) ST else SF {Q} {P && B} ST {Q} and {P && !B} SF {Q} The then-part, ST, must end with Q true The else-part, SF, must end with Q true

32
Hoare’s contribution 1969: Axiomatic basis: Definition of a language in terms of how to prove a program correct. But it is difficult to prove a program correct after the fact. How do we develop a program and its proof hand-in-hand? 32 Dijkstra showed us how to do that in 1975. His definition, called “weakest preconditions” is defined in such a way that it allows us to “calculate” a program and its proof of correctness hand-in-hand, with the proof idea leading the way. Dijkstra: A Discipline of Programming. Prentice Hall, 1976. A research monograph Gries: The Science of Programming. Springer Verlag, 1981. Undergraduate text.

33
How to prove concurrent programs correct. Use the principle of non-interference 33 Thread T1 {P0} S1; {P1} S2; {P2} … Sn; {Pn} Thread T2 {Q0} Z1; {Q1} Z2; {Q2} … Zm; {Qm} We have a proof that T1 works in isolation and a proof that T2 works in isolation. But what happens when T1 and T2 execute simultaneously, operating on the same variables?