CS3 Fall 2005 Lecture week 15

CS3 Fall 2005
Lecture week 15
• The final survey will be up tomorrow:
– you NEED to do this to receive a grade on your project!
• Final:
– Saturday, Dec 17th, 8-11 a.m.
– 155 Dwinelle
– Practice final in reader
• Study help:
– Final review session: Thursday, Dec. 15th, 8 pm – 11 pm.
• Wozniak Room, 430 Soda Hall
– Check the course portal announcements for additional office
hours the week before the final.
– Send questions to Bobak, James, or Nate.
Nov 28
Dec 15
Lecture: What is CS at Berkeley? (guests)
Lab: Big Project
CHECKOFF #1 – Tue/Wed (beginning of
CHECKOFF #2 – Thur/Fri
Lecture: Summary, other languages
Lab: Finish up the Project
CHECKOFF #3 – Tue/Wed
Project Due on Thur/Fri
Final Review Session, 8pm-11pm
Dec 17
Final: 8am-11am, 155 Dwinelle
Dec 5
The project
• 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.
• Any questions about anything?
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
Another list…
Functional programming
Functions as data
Managing large programs
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,
Another list continued
2) Functions as data
– Higher order procedures will take functions as
– It is useful to return functions
– Lambda is quite useful
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
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
Another list continued
5) Managing large programs
– Style: commenting, naming conventions, etc.
– Abstraction: for maintenance and
– Iterative testing
– Reading the specifications, and
communicating often with colleagues
How are you going to study
for the Final?
The language Scheme
• Scheme allows you to ignore tedium and
focus on core concepts
– The core concepts are what we are teaching!
• Other languages:
– Generally imperative, sequential
– Lots and lots of syntactic structure (built in
– Object-oriented is very "popular" now
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"
– to quickly create working solutions for brainstorming,
testing, to fine tune in other languages, etc.
• Recursion isn't used directly (often), but
recursive ideas show up everywhere
Java and PHP
• Java is a very popular programming language
– Designed for LARGE programs
– Very nice tools for development
– Gobs of libraries (previous solutions) to help solve
problems that you might want solved
– Popular course for web development (combined with
a web-server and database)
– Lots of features, but little overall "sense"
– Because programs in PHP execute behind a webserver and create, on the fly, programs in other
languages, debugging can be onerous.
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 =
• query: “Tell me the names of all the faculty who are older
than the faculty member who has been here the
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) );