We show Click here for expected future lectures

Calendar (list of lectures, showing also prelims, some assignments)


PAST AND PENDING LECTURES AND LABS

Lecture 28. 08 May (Thursday). Conclusion. Don't miss it!
CS history and other things pdf   ppt

Lab 13. No assigned lab. The Lab TAs and consultants will be in the lab to answer questions about A7 and the final.

Lecture 27. 04 May (Tuesday). OO programming.
We discuss the idea of OO programming and how one decides on the classes to design and imlpement. We also develop loops or recursive functions in preparation for the final. And we will touch briefly on interfaces. pdf   ppt   showboat.zip (the java demo)


Lecture 26. 28 April (Thursday). Interfaces. An interface is like an abstract class in which all methods are abstract. A class may extend only one other class, but it can "implement" several interfaces. We show how this feature can be used effectively. pdf   ppt

Lab 13. Exception handling. This lab asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. It's best if you read the chapter on exception handling first. pdf   doc   Lab13.java

Lecture 25. 26 April (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


Lecture 24. 21 April (Thursday). Ragged arrays. We show how Java treats a two-dimensional array: as one-dimensional array whose elements are one-dimensional arrays. This allows us to have an array whose rows have different lengths, giving u "ragged" array.   pdf    ppt

Lab 12. 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

Lecture 23. 19 April (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   ppt   Ex.java  OurException.java     Reader.java


Lecture 22. 14 April (Thursday). Listening to GUIs.
We show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf   ppt   javaFilesUsedInClass (zip file) and other examples of gui-listeners: See Chapter 17 of the CD ProgramLive
.

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 21. 12 April (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 20. 07 April (Thursday). Finding an invariant: important algorithms.
We continue our study of developing algorithms that process arrays. No new slides for this lecture. See handouts for last two lectures.

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 19. 05 April (Tuesday). Finding an invariant: important algorithms.
We develop the binary search, linear search, and some sorting algrithms. Sorting.java contains all the searching/sorting methods we use in this class. Download it.    pdf    ppt    Sorting.java


Lecture 18. 31 March (Thursday). Assignment 6 and debugging.
We discuss assignment A6, Images. We then talk about debugging. The powerpoint slides do not show everything we did because we concentrate on finding errors using DrJava. You can look at the lecture at www.cs.cornell.edu/videonote/cornell. pdf    ppt

Lab 09. Reading (and writing) files. We show you how to read a file that is on your hard drive. Reading a keyboard and writing as file is just as easy.   pdf   html    Download lab09.zip or Lab09.java, cms.txt, peop.txt

Lecture 17. 29 March (Tuesday). Finding an invariant: important algorithms.
We look at how to combine 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 16. 17 March (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
File D.java contains the methods we developed in lecture. It also contains the function to roll a die with a apoosible unfair die as well as a procedure that can be used to test it, rolling the die as many times you want and tabulating the results. Take a look!

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 15. 15 March (Tuesday). The while loop.
We introduce the while loop, relate it to the for-loop, talk about the four loopy questions for understanding a while loop, and develop some while loops.   pdf    ppt   D.java   Wrap2.java


Lecture 14. 10 March (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   GrislySnowflakes

Lab 07. Abstract classes and methods. We introduce 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 13. 08 March (Tuesday). Loops
We begin a discussion of loops, starting with a for-loop to process a range of integers. pdf   ppt


Lecture 12. 03 March (Thursday). Drawing and casting about. 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.   pdf   ppt

Lab 06. Recursion. You will write at least 4 recursive functions.   pdf    html   Rec.java

Lecture 11. 01 March (Tuesday). More 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   11mar01demo.zip This file contains (1) Class D, which contains the recursive functions written during this lecture; (2) class PairDI.


Lecture 10. 25 February (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    D.java (contains functions we wrote in class)

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. 23 February (Tuesday). Wrapper classes, class Vector, and more stepwise refinement.
Each primitive type has an associated "wrapper class". An object of the wrapper class contains one value of the primitive type. We show you why this is useful. We also spend more time developing algorithms dealing with Strings, showing you "top-down programming" and "stepwise refinement" in the context of a real java program.  pdf    ppt  Course.java   DeptLink.java


Lecture 08. 17 February (Thursday). Odds and ends on classes. Stepwise refinement
We make some points about multiple constructors, overriding, and constructors in subclasses. We then develop some more String functions and talk about stepwise refinement.     pdf   ppt two classes for anglicization functions:   Anglicize.java   AnglicizeTester.java   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   docx   Methods.java    The Knack

Lecture 07. 15 February (Tuesday). Inside-out, super-this, and stepwise refinement
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   two classes for anglicization functions:   Ang.java   AngTester.java


Lecture 06. 10 February (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

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. 08 February (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.  pdf   ppt   Worker.java   WorkerTester.java


Lecture 04. 3 February (Thursday). Customizing a class: 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  Worker.java   WorkerTester.java    Gremlin.java

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. 01 February (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
Here is Richard Felder's website on learning styles: www4.ncsu.edu/unity/lockers/users/f/felder/public/Learning_Styles.html


Lecture 02. 27 January (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

Lab 01. Java expressions. This lab involves practice with Java expressions and assignments using the DrJava Interactions pane.   pdf   html

Lecture 01. 25 January (Tuesday). Introduction to the course --brief overview of what we missed last Thursday. Discussion of Java types, expressions, variable declarations, and assignment statements. Lecture handout: pdf   ppt

 


 

FUTURE LECTURES AND LABS

The list of lectures and labs shown below are for Spring 2010. They will give you an idea of where we are headed in the Springl 2010 course. The links given below will not work.

Lecture ?. ?? (Thursday). Finding an invariant: important algorithms.
We continue look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop. We develop insertion sort, selection sort, and the recursive quick sort. We give a historical perspective on programming.    pdf    powerpoint    Sorting.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/

 

 opticalIllusions.pps