Click here for expected future lectures

Lecture 28. 30 Apr (Thursday). Conclusion
Don't miss it!

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

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


Lecture 24. 16 April (Thursday). 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

Lab 12. Exception handling. This lab asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. pdf   doc   Lab12.java

Lecture 23. 14 April (Tuesday). 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
.


Lecture 22. 09 April (Thursday). 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

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

Lecture 21. 07 April (Tuesday). Exceptions.
An "Exception" is an event like division by 0, or a subscript out of range. Java has a nice facility for handling and recovering from Exceptions.   pdf    ppt   OurException.java   JLiveRead.java


Lecture 20. 02 April (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    ppt    Sorting.java

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. 31 March (Tuesday). Finding an invariant: important algorithms.
We develop the partition algorithm, binary search, and perhaps a few more. Sorting.java contains all the searching/sorting methods we use in this class. Download it.    pdf    ppt    Sorting.java


Lecture 18. 26 March (Thursday). 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   

Lab 09. Reading 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   LabReadingFiles.java   test.txt   or get them all here:  lab09reading.zip

Lecture 17. 24 March (Tuesday). Assignment 6 and debugging.
We discuss assignment A6, Images. We then talk about debugging a program. The powerpoint slides do not show everything we did because we concentrated on finding errors using DrJava. However, you can look at the lecture at http://www.videonote.net.  pdf    ppt


Lecture 16. 12 March (Tuesday). 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.   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 15. 10 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


Lecture 14. 05 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
09mar05demo.zip contains the four classes concerning blogs that were used to demo for-loops.

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. 03 March (Tuesday). Turtles and loops
We discuss briefly how to draw on a panel of a JFrame using a "Turtle" —you will do this in assignment A5. We then begin a discussion of loops, starting with a for-loop to process a range of integers. pdf   ppt    mailRecip.java    mailGroup.java


Lecture 12. 26 (Thursday). Casting about
You know about casting from int to double and double to int, e.g. (int) 3.4. We now show you how to cast from one class-type to another and discuss why this is useful. And we a talk about a new operator, instanceof. This is the last lecture on classes. pdf   ppt

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

Lecture 11. 24 February (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   09feb24demo.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. 19 February (Thursday). Recursion!
We introduce recursion: a method calling itself. This provides power and flexiblity that we haven't had yet, and you will (should) be amazed at how simple it will be to do neat things.   pdf   ppt    Demo.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. 17 February (Tuesday). Wrapper classes and 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, showing you "top-down programming" and "stepwise refinement".   pdf   ppt 09feb17demo.zip (This file contains the Java files and input files used in this lecture. Download them, unzip them, and load the Java files into DrJava. Read the long long comment at the top of file LieDemoBarbaricVersion.java. You'll see that we give TWO versions of the program to count hits and misses and discuss their differences.


Lecture 08. 12 February (Thursday). Odds and ends on classes. Stepwise refinement
We review some material about classes and make some points about overriding, method equals, and constructors in subclasses. We then develop a method anglicize an integer and talk about stepwise refinement.    pdf    ppt   two classes to anglicize:   Ang   AngTester

Lab 04. Writing functions. You will practice writing functions. These have to do with manipulating Strings, a topic that you will have to know for prelim 1. An important point should become clear: a value of String is an object (manilla folder), 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. 10 February (Tuesday). Inside-out, super-this, and stepwise refinement
We illustrate the inside-out rule for referencing variables and methods that is in most programming languages. We show a problem and introduce this and super to solve it. (Another use of super and this will be shown on Thursday.) Finally, we talk about stepwise refinement as a way to think about the development of methods from their specifications and develop a few methods from their specifications.   pdf    ppt  StockQuote.java   link to code and documentation for In.java


Lecture 06. 05 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. 03 February (Tuesday). The class hierarchy; static variables; more on testing.
We continue our discussion of testing. We talk about the class hierarchy and show you the superest class of them all: Object. We discuss function toString. We introduce static variables.  pdf   ppt   Chapter.java   ChapterTester.java


Lecture 04. 29 January (Thursday). Customizing a class (continued) and testing
(1) We discuss fields and getter and setter methods for them. (2) We introduce constructors, whose purpose is to initialize (some) fields of a newly created object. (3) We show you how to test the methods in a class using a JUnit tester.   pdf   ppt    Chapter.java    ChapterTester.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. 27 January (Tuesday). Customizing a class
We introduce the class definition, which describes the format of all manila folders (object, instances) of a class and defines its methods. This is illustrated using a "subclass" of JFrame to customize it to our needs. We also show how to create a "specification" of the class using the javadoc facility. And we talk about null.   pdf   ppt


Lecture 02. 22 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 gave you practice with Java expressions and the assignment using the DrJava Interactions pane.   pdf   html

Lecture 01. 20 January (Tuesday). Java expressions, variables, declarations, and assignments
We continue discussing expressions in Java (Secs. 1.1 and 1.2) of the text. We show how to cast between int and double. We introduce the variable, declaration, and assignment statement. Lab 01 gives you practice with these features of Java. Lecture handout: pdf    ppt



Below is a list of the expected topics of future lectures and labs.

THE LINKS GIVEN BELOW DO NOT WORK!



Lecture 20. 11 November (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