teaching machines

CS 1: Lecture 33 – Separation of Concerns in Slideshow

Dear students, A primary benefit of object-oriented design is that it helps us organize our programs coherently. 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 […]

CS 1: Midterm 2

See the PDF.

CS 1: Lecture 32 – Stopwatch

Dear students, As 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 of time […]

CS 1: Lecture 31 – Reverse Engineering Objects

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: Lab 10 – Objects and ArrayList

Welcome to lab 10! 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 our own […]

CS 1: Homework 7 – Donde – due before December 21

See the PDF.

CS 1: Lecture 30 – Hello Objects

Dear students, Today we start by finishing up our exercise with the card game. 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 […]

CS 1: Homework 6 – SimFur – due before December 8

See the PDF.

CS 1: Lecture 29 – Growable Arrays

Dear students, Arrays make the modern world happen. The computer itself can be viewed as one big array, lining up all our data, music, photos, and movies on disks and in RAM. However, arrays have their limits. In particular, arrays are fixed in size. We need to know their size when we create them. Sometimes […]

CS 1: Lecture 28 – Arrays in 2D

Dear students, Let’s start today off with some blackboxes. As we solve these, consider which of the four patterns our algorithm fits. Blackbox #1 Blackbox #2 Blackbox #3 Blackbox #4 Blackbox #5 Now let’s consider a famous statistical problem. Suppose birthdays are uniformly distributed across the calendar year. What’s the probability that we in this […]

1 2 3 4 5 35