Course

Computer Science I: Programming Methodology

Programming Methodology is the largest of the introductory programming courses and is one of the largest courses at Stanford. Topics focus on the introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Programming Methodology teaches the widely-used Java programming language along with good software engineering principles. Emphasis is on good programming style and the built-in facilities of the Java language. The course is explicitly designed to appeal to humanists and social scientists as well as hard-core techies. In fact, most Programming Methodology graduates end up majoring outside of the School of Engineering.

28 Lectures

  • Handout Information, Section Sign-up, Karel Commands, An Algorithm vs Program, Syntax of a Karel Program, Running a Karel Program, Creating Methods, SuperKarel, A for Loop, A While Loop, Karel Conditions, If Statement, Putting it All Together

  • Karel and Java

    00:50:31

    Mehran Sahami , Computer ScienceStanford University

    Karel and Java, Common Errors, Comments, Pre-conditions and Post-conditions, Decomposition, The DoubleBeepers Example, Importance of Good Software Engineering, The Right Decomposition, The CleanUpKarel Example

  • The History of Computing, Computer Science vs Programming, What Does the Computer Understand?, The Compilation Process, Java is an Object Oriented Language, Inheritance, Instance of a Class, The acm.program Hierarchy, Your First Java Program, A ConsoleProgram Example, The Graphics Window, The Sending-Messages-to-a-GLabel Example

  • Variables

    00:49:15

    Mehran Sahami , Computer ScienceStanford University

    Variables, Data Types for Variables, Syntax for Using Variables, Classes as Types, Objects as Variables, Invoking Methods on Objects, Graphics Coordinates, Operations on the GObject Class and its Subclasses, Drawing Geometrical Objects, A FunGraphics Example, Expressions and Operators

  • Operators

    00:45:58

    Mehran Sahami , Computer ScienceStanford University

    readInt() and readDouble(), The Division Operator w.r.t ints and Doubles, Order of Precedence for Operators, Type Casting, Shorthands, Constants, The Boolean Data Type, Value Comparisons, Boolean Expressions, Short Circuit Evaluation, Statement Blocks, Scope of Variables, Cascading if, The Switch Statement, The For Loop, The While Loop

  • Information Hiding, The Void Return Type, Parameter Passing Between Methods, Bad Times with Methods, Using Classes, Instance variables vs Local Variables, The RandomGenerator Program Example, The RollDice Program Example, The setSeed() Method

  • Strings

    00:52:26

    Mehran Sahami , Computer ScienceStanford University

    Strings, Writing Your Own Class, Public and Private Visibility, Creating a New Class, The Constructor Method, Shadowing of Variables and the 'this' Keyword, Using the Created Class, Objects are Called by Reference not Called by Value, Class Variables, The JavaDoc, The Student Program Example

  • Importance of Private Variables, Extending the Student Class, Overriding Methods, The acm.graphics Package, GCanvas, Methods Common to All GObjects, Interfaces and Methods Defined by Them, The BouncingBall Program Example, The Geometry of the GLabel Class, The GArc Class

  • The GImage Class, The GPolygon Class, The GCompound Class, Event Driven Programs, The ClickForFace Program Example, Responding to Mouse Events, Responding to Keyboard Events, The UFO program Example

  • Enumeration

    00:49:17

    Mehran Sahami , Computer ScienceStanford University

    Enumeration, Characters, The ASCII Subset of Unicode, Reading Characters, Math on Characters, char as a Primitive Type; the Character Class, Strings and Their Manipulations

  • Memory

    00:46:20

    Mehran Sahami , Computer ScienceStanford University

    Memory, Different Sections of Memory for Different Types of Variables, Memory Allocation Mechanics, The Pointer Viewpoint, The Binky Pointer Fun Video

  • Pointer Recap

    00:48:03

    Mehran Sahami , Computer ScienceStanford University

    Pointer Recap, Why are Objects 'Call by Reference' Instead of 'Call of Value'?, Wrapper Classes for Primitive Types, Files, Code for Opening, Reading and Closing Files, Exceptions, Code for Writing Files

  • Array

    00:49:48

    Mehran Sahami , Computer ScienceStanford University

    Array, Creating a New Array, The ++ Operator, Actual Size / Effective Size of the Array, An Array as a Parameter, Initialize an Array During Creation, An ArrayList

  • Multi-dimensional Arrays, An ArrayList, The Template Class, Methods in the ArrayList Class, An Example Program Using ArrayList, ArrayLists Hold Objects, An Example Program with an ArrayList of Glabels, The GrayImage Example Program

  • An Interface

    00:49:41

    Mehran Sahami , Computer ScienceStanford University

    An Interface, How are Interfaces Implemented, A Map, The HashMap Class, Methods of the HashMap, The Collection Hierarchy, The Map Hierarchy, An Iterator, A HashMap Example

  • GUI

    00:44:52

    Mehran Sahami , Computer ScienceStanford University

    GUI, Interactors in the Context of a Java Program, The Swing Interactor Hierarchy, Window Regions, Creating Interactors, Example Programs, Exploring More Interactors, The InteractiveDrawFace Program Example

  • Introduction to Lecture's material - Searching, Sorting and Algorithmic Efficiency, Searching, Linear Search, Efficiency of Linear Search, Binary Search, Efficiency of Binary Search, Comparing Search Efficiencies, Sorting, The Selection Sort Algorithm, Efficiency of Selection Sort, The Radix Sort Algorithm

  • Principles of Good Software Engineering for Managing Large Amounts of Data, Principles of Design, The Collection Hierarchy, Useful Methods of Collection, The FlyTunes Example Program - An Online Music Store, Defining the Song Class, Defining the Album Class, Seeing the Program Run, Considering the Data Structures Needed, Reusing Data - Shallow Copy vs. Deep Copy, The FlyTunesStore Program Code