Lecture 21 | Programming Methodology (Stanford)

July 3, 2008 by 22 Comments

Help us caption and translate this video on Amara.org: http://www.amara.org/en/v/BH8m/

Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A). Professor Sahami continues lecturing on interactions and pushes it further.

CS106A is an Introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Uses the Java programming language. Emphasis is on good programming style and the built-in facilities of the Java language.

Complete Playlist for the Course:

CS106A at Stanford Unversity:

Stanford Center for Professional Development:

Stanford University:

Stanford University Channel on YouTube:


22 Replies to “Lecture 21 | Programming Methodology (Stanford)”

  1. weleio says:

    Very good lecture
    I learn a lot of it..

  2. zeffii says:

    ^ stares at yahtzee.java.

    one step at a time

  3. slr150 says:

    The talk on ActionListeners is good enough for a student project but this is not how its done in commercial software development

  4. jkurtzman1 says:

    I try to tun the programs but then it says:
    Exception in thread "main" acm.util.ErrorException: Cannot determine the main class.
    at acm.program.Program.main(Program.java)
    Please Help!

  5. Dimitris Pel says:

    @slr150 this happens to be an INTRODUCTION in CS.

  6. First include "import java.awt.Container;" with the other imports. After the class (before the init method) put this statement "Container Panel;". Inside the init method add the statements "Panel = getContentPane();
    Panel.add(tf);". That's it!

  7. @anshul20081 /*
    import java.awt.*;
    import java.awt.event.*;
    import acm.program.*;
    import javax.swing.*;
    public class TextFieldExample extends ConsoleProgram { Container Panel; public void init() {
    setFont("Courier-24"); tf = new JTextField(10); Panel = getContentPane(); Panel.add(new JLabel("Name")); add(new JLabel("Name"), SOUTH); Panel.add(tf); add(tf, SOUTH);
    tf.addActionListener(this); } same actionPerformed method here }

  8. rugovit says:

    where could we find this book of yours?
    name and author at least

  9. This is Java language right??

  10. wvm2008 says:


    Sure is

  11. woodzy6 says:

    You have to import acm.jar into your project file for println or pretty much anything else he is teaching to work. cs106a.Stanford.edu

  12. My look & feel isn't changing the position of sliders, unchecking and checking boxes, depressing buttons, etc… otherwise it's functional, i.e. when I press the "Clear" button, it clears the Graphics Window. Any help out there?

  13. Jma0322 says:

    That's life in the city.

  14. KostaCoffee says:


  15. namefield.addActionListener(this) – I think it means that the namefield sends the event to this object – current object that contains the text field.

  16. Just started object oriented programming and still here so close to being done

  17. Great Lecture! Thanks Mehran

  18. 6502-Coder says:

    Thanks for clearing that up! I was a bit confused about what 'this' meant in this context as I felt the prof was uncharacteristically vague in his explanation.

  19. the examples are outdated.. ( i think ) but the overall vieuw of programming still fits in

  20. MereLee says:

    Ugh! I'm 100% sure that I will forget that thing about the buttons (the stuff at about 7:40) and will have to refer to notes every time I need them D:

  21. why JLabel and not GLabel? Is it cuz technically theres no canvas?