teaching machines

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 […]

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 145 Lecture 30 – ArrayList

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 145 Lecture 29 – Arrays in Two Dimensions

Dear students, We’ve seen that we can create an array like this: type[] id = new type[#]; That type can be anything, like int, String, double, boolean, BufferedImage, and so on. It can also be another array: type[][] id = new type[#][]; Just as 1D arrays let us use one integer to map into a […]

CS 145 Lecture 28 – Arrays * 4

Dear students, With arrays, we are treating the computer as a factory worker, performing some automated task on every item rolling through an assembly line. It’s these mindlessly repetitive tasks that make computers so compelling. While they do the grunt work, we can move on to a more intellectually-challenging exercise, like getting the machine running […]

CS 145 Lecture 27 – Array Patterns

Dear students, After you solve a few array problems, you start to see some regular patterns emerging in your algorithms. Today, we break down a few of those patterns. The payoff of cataloging these is that the next time we encounter an array problem, we can apply the general structure and save our labor and […]

1 7 8 9 10 11 35