Slide 1 Administrivia • Nate's office hours, as usual: Wed 2-4 – Also, Nate will be in 105 North Gate next Monday (May 9th); there is NO lecture, but consider it office hours. – Additional office hours will be announced on the course portal, by TAs and Nate. • The final survey is now available, on the course portal: – you NEED to do this, to receive a grade on your project! Slide 2 The Final • Final: – Thursday, May 19, 5-8pm – Bechtel Auditorium • Final Review Session: – Sunday, May 15 – Wozniak Lounge, Soda 430 (same every time). – Practice final in reader; check course portal for additional resources Slide 3 Projections • Checkoff #3 is the next lab. The TA will run your code. • Project is due at midnight on the day of your lab, this Thursday/Friday. Yeah! • Any questions about anything? Slide 4 So, what have we done in CS3? • Consider the handout of topics – Common topics – Pre-recursion – Recursion – Higher order procedures – Lists – Case studies – Working with large programs Slide 5 Another list… 1. 2. 3. 4. 5. Functional programming Functions as data Recursion Abstraction Managing large programs Slide 6 Another list continued 1) Functional Programming – – – All that can matter to a procedure is what it returns. Small functions can be easily tested (isolated) In other languages, you typically: • • • – Perform several actions in a sequence Set the value of a global or local variable. Print, write files, draw pictures, connect to the internet, etc. Other "paradigms": sequential, object-oriented, declarative Slide 7 Another list continued 2) Functions as data – Higher order procedures will take functions as parameters. – It is useful to return functions – Lambda is quite useful Slide 8 Another list continued 3) Recursion – Linear (simple) to quite advanced – In contrast to iteration and looping (where counters or state define looping constraints) • Knowledge of recursion will help these simpler cases. Slide 9 Another list continued 4) Abstraction – The big idea that is related to everything! – A design practice that makes it possible to carve up a problem, and therefore focus on only part of it. • Makes working collaboratively more efficient Slide 10 Another list continued 5) Managing large programs – Style: commenting, naming conventions, etc. – Abstraction: for maintenance and collaboration – Iterative testing – Reading the specifications, and communicating often with colleagues Slide 11 1. Functional programming 2. Functions as data 3. Recursion 4. Abstraction 5. Managing large programs Slide 12 How are you going to study for the Final? Slide 13 The language Scheme • Scheme allows you to ignore tedium and focus on core concepts • Other languages: – Generally imperative, sequential – Lots and lots of syntactic structure (built in commands) – Object-oriented is very "popular" now Slide 14 CS3 concepts out in the world • Scheme/lisp does show up: scripting languages inside applications (emacs, autocad, Flash, etc.) • Scheme/Lisp is used as a "prototyping" language – to quickly create working solutions for brainstorming, testing, to fine tune in other languages, etc. • Recursion isn't used directly, but recursive ideas show up everywhere Slide 15 SQL (structured query language for databases) resembles HOFs • query: “Tell me the names of all the lecturers who have been at UCB longer than I have.” select name from lecturers where date_of_hire < (select date_of_hire from lecturers where name = 'titteton'); • query: “Tell me the names of all the faculty who are older than the faculty member who has been here the longest.” select L1.name from lecturers as L1 where L1.age > (select L2.age from lecturers as L2 where L2.date_of_hire = (select min(date_of_hire) from lecturers) ); Slide 16