Click here for expected future lectures
Calendar (list of lectures, showing also prelims, some assignments)
Lecture 26. 3 December (Thursday). Conclusion. Don't miss it!
Gries's discussion of CS history pdf ppt
Lee's discussion of research pdf more images
Here are references for the research Prof. Lee described:
1. Dave Crandall, Lars Backstrom, Dan Huttenlocher, Jon Kleinberg. Mapping the World's Photos. Proc. 18th Intl World Wide Web Conference, 2009. Nominated for best paper award. www.cs.cornell.edu/home/kleinber/www09-photos.pdf
2. Website for maps of cities and continents: www.cs.cornell.edu/~crandall/photomap/
3.
Cristian Danescu-Niculescu-Mizil, Gueorgi Kossinets, Jon Kleinberg, and Lillian Lee. How opinions are received by online communities: A case study on Amazon.com helpfulness votes. Proc WWW, pp. 141--150, 2009. www.cs.cornell.edu/home/llee/papers/helpful.pdf
4. Wikipedia entry on the Asch conformity experiments
Lab 13. Exception handling. This lab asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. This lab is optional. During the lab session, you can work on it or on A7. The TAs and consultants will be there to help. pdf doc Lab13.java
Lecture 25. 30 November (Tuesday). Ragged array and applications. We show how two dimensional arrays are implement as one-dimensional arrays whose elements are one-dimensional arrays allowing rows of an array to have different number of elements. We briefly explain applets. And we talk about revealing a message in A6. pdf ppt
Lecture 24. 23 November (Tuesday). Exceptions. An "Exception" is an "untoward" event like division by 0 or a subscript out of range. Java has a nice facility for handling and recovering from Exceptions. pdf presentation ppt presentation pdf Reader.java ReaderDemo.java stockWidget.zip which contains all of the following files: StockQuoteGUI.java StockQuote.java YahooFinanceFailedException.java YahooDataUnparseableException.java In.java
Lecture 23. 18 November (Thursday). Listening
to GUIs.
We show how to listen to events like mouse clicks or entering text in a JTextField. This involves a very quick [shallow] overview of interfaces. We necessarily quickly review placing components in GUIs, as well. Version of the stock-quote GUI (the version in next lecture uses exceptions to handle certain kinds of errors). pdf presentation ppt presentation pdf
zip files for stock-quote GUI that doesn't use exceptions see necxt lecture for a version that does use exceptions
For other examples of GUI-listeners, see Chapter 17 of the ProgramLive CD.
A very brief introduction to eclipse: doc
Lab 11. Timing execution. We show you how to time execution of a method call and ask you to compare times for various searching and sorting methods. pdf doc Sorting.java TestArrays.java
Lecture 22. 16 November (Tuesday). Placing components in GUIs.
We look at placing components in GUIs. The important points we want you to remember is how a BorderLayout manager is used to place components in a JFrame, a FlowLayout manager in a JPanel, and a BoxLayout manager in a Box (and what this all means!). After the lecture, listen to lectures on the CD ProgramLive in chapter 17 --that's
the best way to learn the stuff. pdf ppt zip file containing demos
Lecture 21. 11 November (Thursday). Debugging; applications
We go over the recursion question from Prelim 2, discuss debugging programs, define a Java "application", and show how to create a jar file for an application so that the application can be executed without using DrJava. pdf ppt
Lab 10. Exercises with loops. This lab asks you to develop loops from specifications and given invariants, giving you practice with the methdology for developing loops. pdf doc
Lecture 20. 09 November (Tuesday). Sorting algorithms.
We discuss steganography in assignment A6, Images. We develop insertion sort, selection sort, and quicksort. We talk a bit about the history of our methods of understanding/developing loops and recursive methods. Sorting.java contains all the searching/sorting methods we use in this class. Download it. pdf ppt Sorting.java
Lecture 19. 04 November (Thursday). Finding
an invariant: important algorithms.
After looking quickly at 2-dimensional arrays, we develop some algorithms: Dutch National Flag, partition algorithm, and binary search. Sorting.java contains all the searching/sorting methods we use in this class. Download it. pdf ppt Sorting.java
Lab 09. Reading files. We show you how to read a file that is on your hard drive. Reading a keyboard and writing a file is just as easy. pdf html LabReadingFiles.java test.txt or get them all here: lab09reading.zip
Lecture 18. 02 November (Tuesday). Finding
an invariant: important algorithms.
We look at how to generalize
diagrams for pre- and post-conditions of an algorithm into an invariant
for a loop and use it to develop some interesting algorithms that have loops. pdf ppt
Lecture 17. 29 October (Thursday). Arrays.
We introduce arrays. An array, like Vector, is an object that can contain a list of things. A variable of type int[] contains the name of an object that contains a list of ints. A variable of type JFrame[] contains the name of an object that contains a list of JFrame objects. Type array is built into Java; there is a nice mathematical notation b[i] for accessing element i of array b. We consider right and wrong methods for swapping values of array entries. pdf ppt
Lab 08. For-loops and assertions. This lab deals with some paper-and-pencil exercises on ranges, assertions, and for-loops. It also asks you to write four functions whose bodies contain for-loops. pdf doc Lab08.java
Lecture 16. 27 October (Tuesday). The while loop.
We introduce the while loop, relate it to the for-loop, talk about the four loopy questions for an invariant-based understanding a while loop, and develop some while loops, including linear search, using cities with highest percentage of residents holding advanced degrees as an application. pdf ppt AdvancedDegreesData.java (requires knowing about arrays, the subject of next lecture, and In.java) website with advanced-degree data
Lecture 15. 21 October (Thursday). More on loops.
We continue with the discussion of
developing for-loops that process a range of integers, using postconditions and invariants. pdf ppt
Lab 07. Abstract classes and methods. We work with the notions of abstract classes and methods and state why they are useful. The example program you will play with gives you practice with them. pdf html DemoShapes.java Shape.java Parallelogram.java Rhombus.java Square.java
Lecture 14. 19 October (Tuesday). Loops
We begin a discussion of loops, starting with a for-loop to process a range of integers. We illustrate with some classes that allow us to Send Personalized E-Mail (SPEM). pdf presentation ppt presentation pdf MailRecip.java MailGroup.java
Lecture 13. 14 October (Thursday). More on subclasses: Casting about, abstract methods and classes. We work on further issues with classes and subclasses that arise from the distinction between apparent and real classes, and examine the use of casting and instanceof in these contexts, including the way to write method equals(). We also talk about abstract classes and methods. pdf presentation pdf presentation ppt CS townhall announcement Acct.java Cm.java Um.java
Lecture 12. 07 October (Thursday). Lie detection using recursion. We develop a recursive procedure for determining whether particular words might be false-statement or not-known-to-be-false-statement cues, using political transcripts as data. pdf ppt presentation pdf presentation ppt 10oct07demo.zip The latter file is a zip of a directory that contains (a) LieData.java and TallyPair.java, where TallyPair is our "throwaway" helper class (which is why we made its fields public). (b) In.java for converting file contents to Strings; (c) LieDataTester.java and test.htm, files for running small tests, and (d) powell.htm, a lightly-processed version of Colin Powell's public statements regarding Iraq as annotated by the Iraq War Card project. link to code and documentation for In.java
Lab 06. Recursion. You will write at least 4 recursive functions. pdf html Rec.java
Lecture 11. 05 October (Tuesday). Recursion!
We
develop a few more recursive procedures, including Hilbert's space-filling curve. We execute some recursive calls. As we figure out how many recursive calls one function makes, we will have to discuss the binary number system. pdf ppt presentation.pdf presentation.ppt
10oct05demo.zip This file contains (1) Class D, which contains the recursive functions written during this lecture; (2) class PairDI; (3) classes Demo and Turtle, which were used to draw Hilbert space-filling curves. To draw a space-filing curve, use function Demo.doAHilbert —see its specification.
Lecture 10. 30 September (Thursday). Recursion!
We
introduce recursion: a method calling itself. This provides power and
flexibility that we haven't had yet, and you will (should) be amazed at
how simple it will be to do neat things. pdf ppt presentation.pdf presentation.ppt D.java DTester.java
Lab 05. Class Vector. An instance of class Vector can contain a list of objects, and the list can expand and shrink. In this lab, we study this class. It will be used in a lot of our future work. pdf html Lab05.java
Lecture 09. 28 September (Tuesday). Further development of functions that deal with Strings; class Vector; wrapper classes
We develop a method for "scraping" live stock quotes from the web, and keeping records of these quotes. This involves the use of class Vector, for representing lists, and wrapper classes, for using associated methods. Each primitive type has an associated "wrapper class"; an object of the wrapper class contains one value of the primitive type, plus useful methods. pdf ppt presentation pdf presentation ppt StockQuote.java link to code and documentation for In.java
Lecture 08. 23 September (Thursday). Constructors. Development of functions that deal with Strings
We finish up work on classes: we talk about the bottom-up rule and about writing constructors in subclasses. The main topic is stepwise refinement --a way to think about the development
of methods from their specifications. We develop an interesting function using it: anglicizing integers. pdf ppt presentation.pdf presentation.ppt anglicize.java short video: the knack
Lab 04. Writing functions. You will practice writing functions that deal with Strings. Please study the first part of the lab, on Strings and string equality, BEFORE Tuesday, so that you don't have to waste time in lab. This will help also in understanding Tuesday's lecture. An important point should become clear: a value of String is an object , so a test s == t where s and t are Strings tests whether they are the same folder or not. Method call s.equals(t) should be used to test whether two Strings have the same value. pdf html Methods.java
Lecture 07. 21 September (Tuesday). Inside-out, super-this. Development of functions that deal with Strings
We illustrate the inside-out
rule for referencing variables and methods, which is used in most programming
languages. We discuss this and super. The main topic is stepwise refinement --a way to think about the development
of methods from their specifications-- and develop an interesting function using it. pdf ppt presentation.pdf presentation.ppt Function.java (contains functions we developed in class)
Lecture 06. 17 September (Thursday). Methods
We look more closely at how a method call is executed.
We show the four steps involved in executing a method call. We introduce local variables. We now have four kinds of variable: parameter, static variable, field, and
local variable. You should know where and how each is declared and what
its scope is. We introduce
conditional statements and return statements. pdf ppt presentation pdf presentation ppt Chapter.java
Lab 03. Two topics: testing and static variables. You will practice creating a test class to test and help find bugs in a class that we give you. Also, we give you some things to do to make clear to you when methods can be made static. pdf html ThreeDimPoint.java
Lecture 05. 14 September (Tuesday). Testing; the class hierarchy;
static variables and methods.
We discuss testing, including with JUnit. We talk about the
class hierarchy and show you the superest class of them all: Object. We
discuss function toString. We introduce static variables and methods (didn't get to in 9:05, please read handout/book/see VideoNote). pdf ppt presentation pdf presentation ppt Worker.java (version 2, incorporating concepts from today's lecture) WorkerTester.java
Lecture 04. 09 September (Thursday). Customizing a
class: fields, getters, setters, constructors
We discuss fields and getter and setter methods
for them. We introduce constructors, whose purpose is to initialize
(some) fields of a newly created object pdf ppt presentation pdf presentation ppt Worker.java Gremlin.java (Gremlin.java was not shown in class, but demonstrates what happens when a different class tries to access a private field)
Lab 02. Objects and classes. You will practice creating and manipulating JFrame objects using DrJava's interactions pane. Then, you will write your first class definition —a subclass of JFrame, and experiment with it. pdf html
Lecture 03. 07 September (Tuesday). Customizing a class
We introduce the class definition, which describes
the format of all manila folders (object, instances) of a class. We illustrate using a "subclass" of JFrame
customized to our needs. We show how to create a class "specification" using the javadoc facility. pdf ppt presentation-pdf presentation-ppt SquareJFrame.java
Richard Felder's website on learning styles: http://www4.ncsu.edu/unity/lockers/users/f/felder/public/Learning_Styles.html
6 September NY Times article on study habits
Lecture 02. 02 September (Thursday). We define what an object (manilla folder) is and demo the creation and manipulation of objects in DrJava. This material, in Sect. 1.3 of the text, is the basis for the next lecture, so study the material and practice using DrJava. Look at the self-study exercises in the text and do some of them. The more you practice, the easier it will seem. pdf ppt presentation-pdf presentation-ppt Jeannette Wing's article on computational thinking
Lab 01. Java expressions. This lab involves practice with Java expressions and assignments using the DrJava Interactions pane. pdf html
Lecture 01. 31 August (Tuesday). Java types and expressions and the assignment statement We continue our discussion of Java types, expressions, variable declarations, and assignment statements. Lecture handout: pdf ppt presentation-pdf presentation-ppt
Lecture 00. 26 August (Thursday). Course preliminaries; a few Java types
Introduction to the course: course objectives, ways in which we will help you succeed. Important administrative information. A little about some types (Sec. 1.1 of the text). Lecture handout: pdf ppt
The list of lectures and labs shown below are from a previous semester. They will give you an idea of where we are headed in this semester.
The links given below will not work.
Lab 13. No assignment. The Lab TAs and consultants will be at the lab. Use the time to work on the last programming assignment and be able to ask questions and get help.
Lecture 27. 28 Apr (Tuesday). OO programming.
We discuss the idea of OO programming and how one decides on the classes to design and imlpement. pdf ppt showboat.zip (the java demo)
Lecture 26. 23 Apr (Thursday). Two-dimensional arrays
After we look at
two-dimensional arrays as rectangular arrays, we then show how Java implements two-dimensional arrays and explain how one can have ragged arrays —arrays where different rows can have different numbers of columns. pdf ppt
Lecture 25. 21 Apr (Tuesday). Interfaces.
We introduce the interface as a means for requiring that a class implement certain methods. We show how an interface can be used as a type, and this leads to the ability to write a procedure that will sort an array of elements of any type-class as long as that type-class implements a certain interface. pdf ppt javademo.zip
Lab 11. Formatting in locales. A "locale" is a country together with a language used in that country. This lab gives you experience with class Locale, instances of which give you functions that format numbers, percentages, and currencies in the way that those locales use. For Americans, this can be an eye-opener! pdf html JLiveWindow.java MyJLiveWindow.java
Put this file spin.gif intoyour favorite browser and take the left-brain-right-brain test. This website discusses whether this spinning dancer tells you anything about your brain: scienceline.org/2007/10/29/ask-hsu-spinning-girl-right-left-brain-hemispheres/
Lecture 25. 01 December (Tuesday). Applications
and Applets.
A stand-alone Java program
—one that can be executed outside of DrJava— is either an "application" or
an "applet". An application can be executed from a command line in
a "terminal" or "DOS" window, or one can double-click on them to start it. Applets are started when an html
web page contains the proper "applet tag". We show you how to make a Java program into an application and into
an applet, we show you how to create a jar file that contains an application or an applet, and we also look at the language html, which is used to construct web pages. pdf ppt zip file containing demos