teaching machines

CS 145 Final Exam

See the PDF. At the beginning of every semester of our introductory programming course, I ask my students to tell me about their prior programming experiences, if any. I like to cross-reference their self-reported experience levels with their final grades. The first several years I did this, I found that prior experience wasn’t necessarily a […]

CS 145 Midterm 2

See the PDF.

CS 145 Lecture 37 – Binary Search

Dear students, We close our semester today with a reading from Jeremy Kubica’s Computational Fairy Tales. It demonstrates an algorithm that I think is beautiful: the binary search. We will illustrate the algorithm and implement it to help code up a dictionary. I think this algorithm demonstrates a significant point. This ultra-fast algorithm wasn’t the […]

CS 145 Lecture 36 – Lights Out

Dear students, Today we apply a little bit of everything we’ve learned in a case study of the game Lights Out. We’ll use primitives and objects, ifs and loops, arrays, files, exceptions, graphical user interfaces—the whole shebang! Here’s your TODO to complete before we meet again: Lab tomorrow will be crazy with review sessions, returned […]

CS 145 Lecture 35 – Data Analysis

Dear students, People often ask, “What can I do with computer science?” I usually splutter and stammer out an unconvincing answer, because the answer is pretty much anything. Your choices are many, and they widen near our nation’s larger cities. Some people fear that they will be spending all their time at a computer, but […]

CS 145 Lecture 34 – Slideshow

Dear students, I’ve said several times that object-oriented design helps us organize our code. We can put code and the data that it regularly processes together into the same chunk. Objects allow for the separation of concerns. Class A can focus on its task, and be very good at it. It can be tested and […]

CS 145 Lecture 33 – Stopwatch

Dear students, As we saw with methods, a primary benefit of object-oriented programming is code reuse. We can create a utility and use it over and over again, in many contexts. We will do just that by designing a Stopwatch class. We will use it to time a few operations: a words-per-minute calculator the amount […]

CS 145 Lab 11 – SplatBot

Welcome to lab 11! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. In this lab you will create a robot […]

CS 145 Lecture 32 – Objects Cont’d

Dear students, In object-oriented programming, the programmer is really a writer of screenplays. Objects are our actors, which we orchestrate around the stage. We cue them to say certain things, have them interact with other objects, and shape them to have an identity that is all their own. Today, we’ll feel our away around the […]

CS 145 Lecture 31 – Hello, Objects

Dear students, We’ve seen the Computer as a Calculator, a Chef, a Philosopher, a Pilot, and a Factory Worker. We’ll see it in two more roles: a Scribe and a Creator. A scribe is literate, recording accounts and memories for later retrieval. We’ve already seen how we can use Scanner to retrieve data from a […]

1 2 3 7