CS1110. Lecture/lab summary Click here for expected future lectures Calendar (list of lectures, showing also prelims, some assignments) Past and pending lectures and labs Lecture 26. 3 December (Thursday). Conclusion. Don't miss it! Gries's discussion of CS history pdf ppt Lee's discussion of research pdf 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 Lab 12. Exception handling. This lab asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. This lab is optional. During teh lab session, you can work on it or on A7. The TAs and consultants will be there to help. pdf doc Lab12.java 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 Lecture 24. 24 November (Tuesday). Ragged arrays. pdf ppt Lecture 23. 19 November (Thursday). 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 updated ppt Ex.java OurException.java Reader.java 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 22. 17 November (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 21. 12 November (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 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. 10 November (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 19. 05 November (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 ppt 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 18. 03 November (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 concentrate on finding errors using DrJava. You can look at the lecture at www.videonote.com/cornell. pdf ppt Lecture 17. 29 October (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. We consider right and wrong methods for swapping values of array entries, and look at linear search in the context of finding out which cities have the highest proportion of residents with advanced degrees. pdf ppt AdvancedDegreesData.java In,java 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 understanding a while loop, and develop some while loops. pdf ppt Lecture 15. 22 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 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 14. 20 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 ppt MailRecip.java MailGroup.java Lecture 13. 15 October (Thursday). Drawing and casting about. We discuss briefly how to draw using the ACM graphics package —you will do this in assignment A5. Then 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 updated ppt Acct.java Gm.java Hm.java Lecture 12. 08 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 09oct08demo.zip The latter file contains (a) LieData.java and TallyPair.java, where TallyPair is our "throwaway" helper class (which is why we made its fields public. Note that in the 9:05 lecture we folded this class into LieData.java, which is the "right" way to handle "throwaway" classes, but that technique used some concepts we haven't learned about yet. The solution presented in these files, where TallyPair is a separate class, works fine given our current knowledge); (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. Lab 06. Recursion. You will write at least 4 recursive functions. pdf html Rec.java Lecture 11. 06 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 09oct06demo.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. 01 October (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 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. 29 September (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 dealing with Strings, showing you "top-down programming" and "stepwise refinement" in the context of a real java program. pdf pptx Course.java DeptLink.java Lecture 08. 24 September (Thursday). Odds and ends on classes. Stepwise refinement We develop a method for "scraping" live stock quotes from the web. We then make some points about multiple constructors, overriding, and constructors in subclasses. pdf ppt StockQuote.java SBact.java SBactTester.java link to code and documentation for In.java 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. 22 September (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: Anglicize AnglicizeTester 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 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. Since we did not cover testing last lecture, you won't understand much of this lab until after lecture 5. pdf html ThreeDimPoint.java Lecture 05. 15 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. pdf ppt Worker.java (version 2, incorporating concepts from today's lecture) WorkerTester.java (version 2) Lecture 04. 10 September (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 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. 08 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 Here is Richard Felder's website on learning styles: www4.ncsu.edu/unity/lockers/users/f/felder/public/Learning_Styles.html Lecture 02. 03 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 Lab 01. Java expressions. This lab involves practice with Java expressions and assignments using the DrJava Interactions pane. pdf html Lecture 01. 01 September (Tuesday). Java types and expressions and the assignment statement 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 Lecture 00. 27 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 Future lectures The list of lectures and labs shown below are for Spring 2009. They will give you an idea of where we are headed in the Fall 2009 course. 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 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