Lecture 7 | Programming Methodology (Stanford)

July 3, 2008 by 23 Comments



Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A). Professor Sahami recaps on CASTs, then continues talking about loops, function, methods, and returning.

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:
http://www.youtube.com/view_play_list?p=84A56BC7F4A1F852

CS106A at Stanford Unversity:
http://www.stanford.edu/class/cs106a/

Stanford Center for Professional Development:
http://scpd.stanford.edu/

Stanford University:
http://www.stanford.edu

Stanford University Channel on YouTube:
http://www.youtube.com/stanford

source

23 Replies to “Lecture 7 | Programming Methodology (Stanford)”

  1. Russian View says:

    Also it said 17! = -288522240

  2. DerMagnar says:

    Best teacher ever, but unfortunately alot of outdated things. For the loop and a half thing you only need a do{} while(); loop.

    public class Add {

           public static void main(String[] args) {
                 int total = 0;
                 int val;

                 do{
                        Scanner reader = new Scanner(System.in);
                        System.out.println("Enter val:");
                        val = reader.nextInt();
                        total += val;
                        }while (val !=0);
                 System.out.println("your total is " + total);
           }
    }

    no constant SENTINEL, no break needed. works perfectly fine.
    It also happens, theres no more ConsoleProgram Class. Instead you need to create an object of a class that can read user input. For instance Scanner.
    http://stackoverflow.com/questions/5287538/how-to-get-basic-user-input-for-java

    btw. 6 weeks ago, i knew as much about programming as my grandmother. Learning all online on youtube and through pdf.s.  Hell of a ride.

  3. Hiken Ace says:

    Well this one escalated quickly … considerably harder than Lecture 6 ! Need to watch it a couple of more times !

  4. Susan Foley says:

    I went to Stanford back in the dark ages before desktop computers were invented and it's great how much this reminds me of home.

  5. Stefan KOGUT says:

    Finally, factorial problem solved without recursion presented into an official course…

  6. The gamer says:

    I should see it 10 times:(

  7. The gamer says:

    in 46:46
    fillcolor (double x
    double y
    double r)
    what is r ?

  8. The gamer says:

    what is the addition of double r ( reduce ) ?

  9. Joseph Edm says:

    how match is the value of getHeight()?

  10. Alp Aksın says:

    truly inspirational course.

  11. 21:35 that homie just burped

  12. Tuts Cloud says:

    Hey everyone. Anyone doing homework from the book? if yes, I would like to see your code, also I will share mine, cause i'm interested, if you solved the problems like me, maby there are better ones, than mine…))

  13. 2017, watching 360p lectures. 10/10, would do again

  14. WinstonSmith says:

    Alice in Chains? man Mehran just gets more awesome every lecture

  15. It is safe to declare a local variable inside a loop because it dies when arriving to loop end

  16. sgrocker1 says:

    Roger Daltrey is not dead!

  17. Shy Wolf says:

    Does anyone know if this information is still relevant for java in 2018? I noticed that some things seem slightly different, although the similarities seem to much overpower the differences, will I just be confusing myself by learning about an older version of java? Coming from a beginner who is just starting to grasp the basics of java.

  18. Malitia HD says:

    wait, if you insert a 0 into the factorial wouldnt it create an infinite loop since 1<=0 is not true? 1 is greater than zero

  19. mlukahot says:

    @6:40, more or less. Isn't the "break" instruction just like the infamous "goto" that gave rise to "spaghetti code", so many years ago and which "structured programming" was invented to avoid??? Personnaly, I think the first solution to this problem was better. Even if it meant "repeating" the same instruction twice…

  20. These series of videos have been out there for over 11 years and I never knew they existed. I've been programming professionally for about 5 years now, and even though I know most of the stuff he talks about, I can't stop watching these videos just because of the simplistic way in which he explains things, hoping that I could pick one or two things from him that I haven't learnt yet. Undoubtedly the best lecture series I've ever watched. Thank you so much Professor Sahami or Mehran as he'd like to be referred as.

  21. Who else is watching in 2020 #Richalikhyani