Lecture 11 | Programming Methodology (Stanford)

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 มิ.ย. 2024
  • Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A). Professor Sahami lectures on GObjects, GImage, Gcompound, and Gpolygons. He then shows how to incorporate the mouse and keyboard into the graphics.
    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:
    th-cam.com/users/view_play_list...
    CS106A at Stanford Unversity:
    www.stanford.edu/class/cs106a/
    Stanford Center for Professional Development:
    scpd.stanford.edu/
    Stanford University:
    www.stanford.edu
    Stanford University Channel on TH-cam:
    / stanford

ความคิดเห็น • 112

  • @mikehoward4856
    @mikehoward4856 6 ปีที่แล้ว +27

    This is where the fun begins. Interesting how these concepts remain relevant almost 9 years on.
    Quick tip for those having difficulties - go slow and work out the examples. Let me explain. As you progress with the lectures, you'll find yourself getting lost. This is fine. Its just your brain adjusting to new information. To truly understand new information, pause and repeat over and over till you get the concept cold. For example, i was having difficulties understanding the concept of coding the animation. So i took out the code and wrote it out with a pen. I went through it piece by piece trying to understand the reason behind each line of code. I did this repeatedly until i understood animation cold.
    In summary, rewind, rewrite and repeat until you understand.

    • @samagrabarnwal
      @samagrabarnwal 2 ปีที่แล้ว

      heyy, I have a doubt. I just started watching this playlist and I'm confused about how do I practice this stuff and how do I get started?. I'm using IntelliJ as my IDE and I don't know how to use acm libraries within it, because it gives me an error saying that It "Cannot resolve symbol acm". How do I actually implement this stuff? Is the code that I write based off on these lectures still valid in java 17? If not, how do I go about it?

  • @aluminabrain1738
    @aluminabrain1738 8 ปีที่แล้ว +22

    He uses every second of lecture. Awesome.

  • @shreyaspadhye7337
    @shreyaspadhye7337 3 ปีที่แล้ว +10

    2020 and still relevant. This guy is a legend. Love all the little jokes in between

    • @samagrabarnwal
      @samagrabarnwal 2 ปีที่แล้ว

      heyy, I have a doubt. I just started watching this playlist and I'm confused about how do I practice this stuff and how do I get started?. I'm using IntelliJ as my IDE and I don't know how to use acm libraries within it, because it gives me an error saying that It "Cannot resolve symbol acm". How do I actually implement this stuff? Is the code that I write based off on these lectures still valid in java 17? If not, how do I go about it? How did you learn it? Do you gave any suggestions?

    • @117_soumyajeetsengupta3
      @117_soumyajeetsengupta3 ปีที่แล้ว

      ​@@samagrabarnwal acm libraries as per my notice are not relevant now they are replaced with libraries like
      import java.util.*;
      and for gui there are swing libraries.
      To stay updated about how to make input output GUI's in todays time do check out GFG and java docs. Lectures are great but in some places you need to crosscheck.

  • @iMickyrich
    @iMickyrich 12 ปีที่แล้ว +1

    mehran we all are doing good.. we all love you

  • @daniel10263
    @daniel10263 9 ปีที่แล้ว +11

    Topics: 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

  • @abderrachidesghir3745
    @abderrachidesghir3745 7 หลายเดือนก่อน +1

    is about to be 2024 and we still rocking as Mehran would say

  • @DBBW1
    @DBBW1 11 ปีที่แล้ว

    Prof Mehran is a great teacher. Whenever I think i'm lost in the book assignments I check the lectures and everything make sense again.

  • @miguelmorales3979
    @miguelmorales3979 11 ปีที่แล้ว

    I learned more in a single lecture of this guy than my first semester at the school I graduated from. I don't know if it is Stanford or Mehran or both, but it is so great to have this videos out.

  • @grunder20
    @grunder20 12 ปีที่แล้ว

    I'm in awe about the syntax!

  • @Arkantheawesome
    @Arkantheawesome 12 ปีที่แล้ว +1

    Mehran is AMAZING

  • @alfal85
    @alfal85 13 ปีที่แล้ว +1

    Mehran, Thank you so much. this is great

  • @richarddemeny611
    @richarddemeny611 8 ปีที่แล้ว +5

    Hang in there guys

  • @DenysLazarenko
    @DenysLazarenko 12 ปีที่แล้ว +2

    24:50 oh i LOVE this course. Good times!

  • @StephenRayner
    @StephenRayner 15 ปีที่แล้ว

    Grate lecture Stanford. You really are a good teacher Mehran.

  • @xy008areshsu
    @xy008areshsu 13 ปีที่แล้ว

    Mehran is the man, he is soooooooo gooooooooood!!!!

  • @KenechiLearnsCode
    @KenechiLearnsCode 9 ปีที่แล้ว +21

    Anybody else having difficulty wrapping their head around parameters? Can anyone recommend a good resource for learning more about them and how they work? On a separate, unrelated note, this has 98,727 views. Lecture 1 has 1.5 million. Pat yourself on the back if you're still here.

    • @dg-hughes
      @dg-hughes 6 ปีที่แล้ว

      My explanation is parameters are just the info an object uses. Oracle's Java docs are a great source in fact the source, docs.oracle.com/javase/tutorial/index.html

    • @cynicist8114
      @cynicist8114 5 ปีที่แล้ว

      I know this is old, but think of parameters as things you are passing into the function container. The function container acts as an environment or a namespace for that particular function, and nothing exists in that container unless you either create it yourself explicitly by declaring and initializing a variable, or by passing in something from the outside when you call the function.

    • @ludacrisbutler
      @ludacrisbutler 5 ปีที่แล้ว +1

      I know this is old but..
      Imagine you are making a form for someone to enter their email address. You want to save that email address as a String. In order to save it, you need to receive it, and to receive it you take it in as a parameter. Using pseudo-code, you would do something like this:
      public class User
      private String emailAddress;
      public void storeEmail(String newEmailAddress)
      emailAddress = newEmailAddress;
      The simplest example I can think of would be if someone needed you to write a method that adds two numbers together and returns the sum:
      public int add(int num1, int num2)
      int sum = num1 + num2
      return sum

    • @osmankhalil339
      @osmankhalil339 4 ปีที่แล้ว

      as he said in cdPlayer example , parameters are the disk itself , the device is the method("function"). . so parameter is the data u need the function to process but not all functions have parameters

  • @mkwendo
    @mkwendo 8 หลายเดือนก่อน

    STILL A LEGEND

  • @AaaRrrLllUS
    @AaaRrrLllUS 9 ปีที่แล้ว

    what method should we use for our Breakout assignment, mouseMoved() or mouseDragged() ? . I mean our paddle moves when we move our mouse or when we click and drag the paddle?

  • @Ezixax
    @Ezixax 12 ปีที่แล้ว

    @Preevailer The acm package is included in your Eclipse.

  • @pker5range
    @pker5range 11 ปีที่แล้ว

    is it required to list out all the lengths and widths of the face (the eyes and stuff) as constants (private static final double) or is it just good style? couldnt you save time and just list them as normal variables (int ______ = 0.10)?

  • @leot7
    @leot7 11 ปีที่แล้ว

    If anyone is having trouble with GImage, in the latest java version, I have found it best to put the image in the bin folder in the project in your workspace.

  • @Code_in_simple_English
    @Code_in_simple_English 12 ปีที่แล้ว

    Another great lecture. Modified the bouncing ball code as Mehran suggested to get the bouncing face by using the GFace class and first, much to my disappointment it didn't work. Ecilpse gave back a message "GFace cannot be resolved to a type". Of course I hadn't a clue what that meant. Googling the error, though, I found our that this is known Eclipse bug and you can select Project, clean and it will get rid of it and now I have my bouncing face :-) Good times!!! Moving onwards and upwards!!

  • @mOuannochIpa
    @mOuannochIpa 6 ปีที่แล้ว +2

    Does anyone have the complete code please?
    It is very difficult for me to see it clearly on the screen, it looks very blurry.
    Thank you.

    • @osmankhalil339
      @osmankhalil339 4 ปีที่แล้ว

      i think most code is in the book

  • @Milantex88
    @Milantex88 14 ปีที่แล้ว

    35:47: Mouse moved, mouse moved, mouse moved!!! :) Genius!

  • @Thegamer-yp7qq
    @Thegamer-yp7qq 8 ปีที่แล้ว

    I searched for another source to learn more about Gcompound
    but I didn't find anything . just this lecture. .
    anybody know another source . tell us

  • @imorio
    @imorio 14 ปีที่แล้ว

    @DillonSundance Well, I have a different java book and it uses exactly the same library's for the most part, so they aren't that random.

  • @narutokunn
    @narutokunn 6 ปีที่แล้ว

    How is he creating a RandomGenerator object without extending the RandomGenerator class ?

  • @warnexus
    @warnexus 11 ปีที่แล้ว

    Prof Mehran already gave you the hint: use getElementAt method. This method checks the front most object at that point.

  • @Artilla2012
    @Artilla2012 10 ปีที่แล้ว

    i bought a book called java for dummies. but these lectures are way more usefull..

  • @DrGenius73
    @DrGenius73 14 ปีที่แล้ว

    You can download a preliminary draft version of the book for free. It doesn't have some of the later chapters of the final version but chapter 8 of the draft is the one you'll want to use for the breakout assignment. It discusses the acm graphics library and event handling.

  • @tobalaba
    @tobalaba ปีที่แล้ว

    Where can I see the book and the assignment? Thanks

  • @XRenkoX
    @XRenkoX 13 ปีที่แล้ว

    How i the standford system set up ? For example is 106A a freshmen level class still? Yes I am such randomly asking

  • @scienceblossom6197
    @scienceblossom6197 ปีที่แล้ว

    Amazing teacher, I wish Mehran did TH-cam videos as well ❤️‍🩹

  • @TheMichaeljmanzella
    @TheMichaeljmanzella 10 ปีที่แล้ว

    Just bought the original star wars DVD. "Its so good," Mehran Sahami.

  • @LinusLexfors
    @LinusLexfors 13 ปีที่แล้ว

    Im having trouble with the GImage.
    It just says it doesn't find my file, although it IS in the right folder...

  • @DrGenius73
    @DrGenius73 14 ปีที่แล้ว

    The Eclipse IDE is being used through the entire course. Just start a new project and copy/paste the bouncing ball code from the handout. Also don't forget to add/link the acm library package to your project.

  • @jeffersondelmar
    @jeffersondelmar 14 ปีที่แล้ว

    where can i get the slides used in the lecture?

  • @Yknarfrod
    @Yknarfrod 13 ปีที่แล้ว

    Can someone please help me? Every time I try to run a program that uses GCompound it says that my acm.jar file is missing the source for GCompound. I have tried redownloading it and installing it various times but it still doenst work! Please any help will be greatly appreciated.

  • @barn777777
    @barn777777 14 ปีที่แล้ว

    What you get choclates for asking questions?

  • @Thegamer-yp7qq
    @Thegamer-yp7qq 8 ปีที่แล้ว

    I must extends Gcompound? ??

  • @m3tafunj
    @m3tafunj 8 ปีที่แล้ว

    I'm having another problem with Breakout. I can get the ball by starting the game in the mouseevent but it loses focus on the screen so it appears as though the ball is sitting still and then all of a sudden it is at the bottom of the screen. I guess there needs to be a away to put focus on the canvas after the mouse listener event, or on the ball. I can run the start game in the run method but it just starts as soon as the game loads, so I suppose another option would be to have a loop in the run method that is waiting for the mouse click and then proceed within the run method, but I suspect the code should execute inside the mouseclick method.

    • @m3tafunj
      @m3tafunj 8 ปีที่แล้ว

      +m3tafunj Just found the answer: there is a waitForClick() method. You can find out about it if you read the YEAH notes at: web.stanford.edu/class/archive/cs/cs106a/cs106a.1134/handouts/yeahBreakout.pdf

  • @Electronieks
    @Electronieks 14 ปีที่แล้ว

    WHICH software , he uses for bouncing ball ed?

  • @leot7
    @leot7 11 ปีที่แล้ว

    I wish that this video could be of better quality because sometimes it can he hard to see the text in eclipse. I really like the videos though.

  • @gracchusBE
    @gracchusBE 10 ปีที่แล้ว

    when making the Breakout program i got to the problem that when i try to make the collisions with the bricks it only collided with one of those bricks, I guess that this is cous i add the bricks with a for loop and i assume that after it is placed only the canvas remembers its there but my program overwrites it with the next brick of the for loop? is there a way around it??

    • @prateekbanga3074
      @prateekbanga3074 7 ปีที่แล้ว

      obviously if won't collide with multiple bricks at once. It can go to another brick after colliding with another brick though, but the ball will collide with one brick at once.

  • @James-un6kx
    @James-un6kx 8 ปีที่แล้ว

    I'm trying the code for the mouseTracker, but I'm getting this error:
    The source attachment does not contain the source for the file JTFTools.class.
    Heres my code:
    import acm.graphics.*;
    import acm.program.*;
    import java.awt.event.*;
    public class MouseTracker extends GraphicsProgram{
    private GLabel Label;
    public void run(){
    Label = new GLabel("");
    Label.setFont("Times new Roman - 36");
    add(Label,50,50);
    addMouseListeners();
    }
    public void mouseMoved(java.awt.event.MouseEvent e){
    Label.setLabel("Mouse: ('" + e.getX() + ", " + e.getY() + ')');
    }
    }
    If someone could help I would apreciate it.

  • @warriorsquest
    @warriorsquest 15 ปีที่แล้ว

    Try getting the book. The Art of Science of Java by Eric S. Roberts. Of course without looking at your code, no one can tell where you may have gone wrong. Good luck.

  • @xVerbati
    @xVerbati 12 ปีที่แล้ว

    @xVerbati nvm he asked if you can rotate polygons, anyone know how?

  • @juvvalapalem
    @juvvalapalem 8 ปีที่แล้ว

    at 37:19 in the screen on mousetracker program ......why is it label = new GLabel(""); and not ....GLabel label = new GLabel(""); the first one in running well but second one is showing error

    • @prateekbanga3074
      @prateekbanga3074 7 ปีที่แล้ว +1

      because he has already declared the label variable or in this case object.

  • @Sintaxx2
    @Sintaxx2 12 ปีที่แล้ว

    How do you get the ACM library working in eclipse? I downloaded the stanford eclipse version and I downloaded a file called acm.jar, what do I do with acm.jar?

  • @abdulkhader251
    @abdulkhader251 11 ปีที่แล้ว

    I have GFace Class in my workspace ,I run "click for face" program ,but it doesnt work ...
    somebody help me please !!!

  • @m3tafunj
    @m3tafunj 9 ปีที่แล้ว

    I'm trying to write the breakout program without having to create 5 different functions for creating each color row. I'm not sure how to set the color element anyway other than hard coding it though. SetColor(Color.red) works but SetColor.(Color.strColor) where strColor = "red" doesn't work.
    Any ideas?

    • @LocNguyenCrypto
      @LocNguyenCrypto 8 ปีที่แล้ว +1

      setColor is method, SetColor is a class.
      if you use method , it's need parameters. I think Color.red is call the method red of class Color, and it return specific value has type method setColor require.
      The easy way to know is read javadoc of that Class you used.

  • @pker5range
    @pker5range 11 ปีที่แล้ว

    if there is only an imaginary reference point how did the compputer know where to draw that first point?

  • @ddubs123
    @ddubs123 13 ปีที่แล้ว

    is add a function and not a method?

  • @Sintaxx2
    @Sintaxx2 12 ปีที่แล้ว

    Ye, I found it already, thanks anyways :) Adding libraries in pretty darn easy, I think I'll find it hard to go back to C++.

  • @johnnyervin3792
    @johnnyervin3792 12 ปีที่แล้ว

    Agreed
    :]

  • @historybuff09
    @historybuff09 12 ปีที่แล้ว

    Mehran is hilarious!

  • @warriorsquest
    @warriorsquest 15 ปีที่แล้ว

    The Art and Science of Java by Eric S. Roberts

  • @pker5range
    @pker5range 12 ปีที่แล้ว

    why is the quality not as good?

  • @ChristopherFortin
    @ChristopherFortin 10 ปีที่แล้ว

    entropy

  • @xVerbati
    @xVerbati 12 ปีที่แล้ว

    what did the guy ask at 11:25???

  • @dg-hughes
    @dg-hughes 6 ปีที่แล้ว +1

    I'm watching the lectures but for some reason this one Lecture 11 the video quality is quite bad. I'm watching it on a 55 inch TV and still can barely make out some of the characters. A current (2017) version of this Java tutorial would be great maybe in 2018 since it would be ten years anniversary of the original. Lots of changes to Java and video technology. Actually I just thought this is more than likely filmed on MiniDV tape there wouldn't have been any good consumer digital sources in 2008.

    • @Septix
      @Septix 6 ปีที่แล้ว +3

      Yeah but the problem is getting another professor like Mehran to teach it...

  • @reverend900
    @reverend900 12 ปีที่แล้ว

    Mehran can make even some of baddest of students to pay attention on his teaching ..
    Lot of examples in youtube ... LOL me tooo

  • @pker5range
    @pker5range 12 ปีที่แล้ว

    @S2h6699
    if you look at it that way, he also forgot the class, braces, etc

  • @Saganist420
    @Saganist420 6 ปีที่แล้ว

    He sure likes to say funky a lot.

  • @davdusmc
    @davdusmc 11 ปีที่แล้ว

    The S in String and System should be lower cased.

  • @MrKostaCoffee
    @MrKostaCoffee 12 ปีที่แล้ว

    26:40 SEND OUT MY MINIONS!!!!

  • @xVerbati
    @xVerbati 12 ปีที่แล้ว

    @ddubs123 You probably already know the answer by now seeing as your comment is 9 months ago, but i'll tell you anyway, they're the same thing, function is basically just the term in the c++ language as in java they are called methods, and since he probably teaches both, he prob gets em mixed up but it doesn't matter.

  • @TamNguyen-wd4op
    @TamNguyen-wd4op 9 ปีที่แล้ว +1

    BouncingFace.EXEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!

  • @jasonwojcik6137
    @jasonwojcik6137 12 ปีที่แล้ว

    Create a project. Right click 'src'. Chose 'Build path' --> Configure build path. Select the 'Libraries' tab. Click Add external .jars button. Pick the file. When you do it right, acm.jar is listed under Reference Libraries and you can import in your classes.

  • @wlycdgrTheEverydayWorld
    @wlycdgrTheEverydayWorld 14 ปีที่แล้ว

    "...an hour and a half later I was like, 'whoo, there it is!' and then I wept."

  • @vesperiaLSU
    @vesperiaLSU 10 ปีที่แล้ว

    @chen viewed

  • @ChristopherFortin
    @ChristopherFortin 10 ปีที่แล้ว +1

    i took this course and all I got was diabetes

  • @maiabuajamieh7153
    @maiabuajamieh7153 3 ปีที่แล้ว

    If you need methodologies more than java doc start from 14:00 minutes

  • @Guylovesleep6802
    @Guylovesleep6802 2 หลายเดือนก่อน

    28:52 I have not even graduated from highschool and why am i getting called out like that(;-;)

  • @JonnyBoy2841
    @JonnyBoy2841 15 ปีที่แล้ว

    Has anyone completed the breakout assignment just by watching these videos? I'm been trying to get through the assignments just with the videos, but without a book or a teacher to ask questions it is very difficult and I can't make my paddle move in one direction only :/

    • @prateekbanga3074
      @prateekbanga3074 7 ปีที่แล้ว

      I completed it just now. I know, I'm a bit late.

  • @caiyuhui
    @caiyuhui 13 ปีที่แล้ว

    follow "caiyuhui" in twitter to discuss...

  • @curran903
    @curran903 10 ปีที่แล้ว

    Y is this program not working??
    import java.awt.event.*;
    import acm.graphics.*;
    import acm.program.*;
    public class MouseEvent extends GraphicsProgram {
    public void run() {
    addMouseListeners();
    }
    public void mouseClicked(MouseEvent e) {
    GRect rect = new GRect(30,30);
    add(rect, e.getX(), e.getY());
    }
    }

    • @M0stBlunt3d
      @M0stBlunt3d 10 ปีที่แล้ว

      Try using public void init() { instead of run method.

    • @curran903
      @curran903 10 ปีที่แล้ว

      M0stBlunt3d Thanks for your suggestion, but it worked later. My java was broken, so I downloaded A different version of eclipse.

    • @M0stBlunt3d
      @M0stBlunt3d 10 ปีที่แล้ว

      Curran C Doddabele how did you get it to work? What version of Eclipse are you using. I've been struggling with the import Java awt. I've got the latest JDK but it won't allow me to import.

    • @curran903
      @curran903 10 ปีที่แล้ว

      change the method mouseMoved(MouseEvent e){} to moveMoved(java.awt.event.MoseEvent e){} then it will work...you don't need to import java.awt.event.*; for this.

  • @paalowa
    @paalowa 15 ปีที่แล้ว

    then i wept...

  • @phartatmisassa5035
    @phartatmisassa5035 10 ปีที่แล้ว +4

    Shhh...
    No talking in class.

  • @dvdcastav
    @dvdcastav 14 ปีที่แล้ว

    He did a bouncing face out of his roomate's face when he was our age!

  • @Nigel-Webb
    @Nigel-Webb 11 ปีที่แล้ว

    Sounds like you have a corrupted workspace.
    So here's the fix:
    First remove the folder containing your "face" program from the Eclipse workspace panel. (Right click on folder, click delete).
    Next, locate "root" folder containing your "face" program on your PC.
    Double click ".metadata"
    Double click ".plugins"
    Right click on "org.eclipse.core.resources", then click delete.
    Now re-import folder with your "face" program to the Eclipse workspace.
    .
    Should now work like a dream...

  • @ivans9354
    @ivans9354 11 ปีที่แล้ว

    Incorrect.

  • @zibbamonster69
    @zibbamonster69 10 ปีที่แล้ว +1

    why is the quality of the video becoming shittier with every lecture, i can barely read the code when mehran is presenting it now...

  • @Jma0322
    @Jma0322 11 ปีที่แล้ว

    17:38 He totally lost it.

  • @driversteve9345
    @driversteve9345 5 ปีที่แล้ว

    I think he's done this a few times! Ya think? LoL!

  • @ctertony7049
    @ctertony7049 9 ปีที่แล้ว

    The translation form english to chinese is bad,like a japanese class.

  • @erikid247
    @erikid247 12 ปีที่แล้ว

    i was just kidding

  • @erikid247
    @erikid247 12 ปีที่แล้ว

    1 person got rejected from Stanford

  • @mselaineryan
    @mselaineryan 10 ปีที่แล้ว

    Click for Face? Hmmm.

  • @robbielee4251
    @robbielee4251 11 ปีที่แล้ว

    use the god dam microphones

  • @digitalGenetics
    @digitalGenetics 15 ปีที่แล้ว

    cheese anyone?