Lecture 3 | Programming Methodology (Stanford)

Поделиться
HTML-код
  • Опубликовано: 20 янв 2025

Комментарии • 392

  • @Steve.Nguyen
    @Steve.Nguyen 6 лет назад +95

    00:00:25 Karel and Java
    00:02:00 Common Errors
    00:07:05 Comments
    00:11:12 Pre-conditions and Post-conditions
    00:13:09 Decomposition
    00:19:47 The DoubleBeepers example
    00:36:26 Importance of Good Software Engineering
    00:39:59 The Right Decomposition
    00:44:08 The CleanUpKarel example

  • @SwirlOfColors
    @SwirlOfColors 11 лет назад +38

    In less than two hours total, my look at programming changed completely: now it all makes sense.
    Mad props for Stanford, and the professor!

    • @theeligator8728
      @theeligator8728 7 месяцев назад

      hey how you doing lol 11 years passed are you a programmer?

  • @ritvikkarra1916
    @ritvikkarra1916 4 года назад +23

    This professor is simply amazing. I am using a lot of different resources to learn Java right now, but his approach to teaching, especially with the top-down approach, is so simple and yet so elegant. We are blessed to have this lecture series for free on RUclips.

  • @todd.foster77
    @todd.foster77 10 лет назад +50

    Thanks Mehran for making this so lighthearted and funner than it should be. You have a great gift for teaching. Programming is the only thing I haven't done with computers and I should have started programming years ago. I'm taking the plunge now (at 44) and I'm so glad I found you and your course. Many blessings to you and your family.

    • @Supsandroid
      @Supsandroid 7 лет назад +2

      Todd Foster how have you come along in these two years? I'm starting up now myself 😀

    • @todd.foster77
      @todd.foster77 7 лет назад +3

      I have not had the time I wanted to do this. With work, toddlers, and attending college online, it is tough. My major is cybersecurity and programming is part of my curriculum, so I will be able to get back to it later. Thanks for asking.

  • @TroyAPeterson
    @TroyAPeterson 11 лет назад +48

    Mehran Sahami is my new favorite professor.

  • @andrewmendonca1571
    @andrewmendonca1571 8 лет назад +44

    It's sad that not all professors at research universities are like this guy. This guy is amazing.

  • @seppukusayonara
    @seppukusayonara 9 лет назад +74

    c'mon Stanford, we need more Mehran online

    • @Mikeybryce99
      @Mikeybryce99 9 лет назад +4

      seppukusayonara he actually taught me computer programming from my bedroom, when i was eight. Love this guy haha

    • @BruceWayne-fs8ty
      @BruceWayne-fs8ty 9 лет назад +9

      VivaLaMikey when you were FUKING EIGHT!?!? I'm 20...why the fuk should I even learn programming if you're 8 and you already know more then me....

    • @kalphitekil
      @kalphitekil 9 лет назад +2

      +Bruce Wayne yeah just give up. youre too late and not worth it

    • @ruiferro4160
      @ruiferro4160 9 лет назад +8

      +Invisiblefiyah Nobody would ever do anything if we were all to follow your logic.
      There are 7Billion people in the world.... a good part of which cannot even read or write.

  • @paulo1940
    @paulo1940 10 месяцев назад +5

    checkin for all the 2024 students out there watching these works of art!

  • @sciencemeansrowka
    @sciencemeansrowka 12 лет назад +6

    After a year of private study, this is my favorite programming video so far.

  • @johnadams3259
    @johnadams3259 11 лет назад +6

    Finally, I'm beginning to understand! What an awesome teacher.

  • @azuz16
    @azuz16 14 лет назад +1

    Respect to Mehran Sahami
    He teach from basics and makes programming peace of cake,
    I wish I got lecture like him , ill score "A" in his subjects
    all students attend his classes should be thankful .

  • @Sawta
    @Sawta 15 лет назад +1

    Man, this professor is amazing!
    Funny, knowledgeable, well spoken *and* can present computer concepts in an interesting, fun way!

  • @iamabean
    @iamabean 8 лет назад +8

    I have started programming without watching this video in the first place. At a result, I spent a lot of time fixing my program over and over. It was a huge waste of time!!!! THanks Prof!!!! This is a very value advice for me

    • @timothyteves8715
      @timothyteves8715 8 лет назад +1

      cool i'm new at programming, do i need to download eclipse and write all the codes that were on the video? or do i just have to watch and get the lessons, I'm learning swift.

    • @rahinhaider
      @rahinhaider 8 лет назад +1

      Same here. Solved the Checkerboard problem but after a lot of hassle, declaring integers and booleans and what not. Doing it again.

    • @zainahmed6502
      @zainahmed6502 8 лет назад +2

      ummm it li literally impossible to learn without physically doing it. It's like math, you have to write down the problem and solve it in order to understand it. It doesnt matter if you are doing swift, most methods he teaches are used in all of the languages.

  • @werewasyo
    @werewasyo 8 лет назад +31

    need an HD VERSION!

  • @monsterhunter99
    @monsterhunter99 13 лет назад +1

    I hope when I go to a university I will have a professor like him. He gets the class laughing and he gives them candy for questions :D Not to mention he actually gets the lesson done perfectly.

  • @xX123Dorian123Xx
    @xX123Dorian123Xx 6 лет назад +8

    at 26:00 he is exactly right, I've finally understood that I have to learn fundamentals and I'm screaming inside "THAT FUNCTION WASN'T DEFINED!" XD

  • @debit256
    @debit256 14 лет назад +1

    Great professor that goes around many basic aspects of coding. He creatively utilizes Karole to convey the processes of [hard] to grasp keywords for beginners of Java in ways so linguistically simple. My freshmen professor just teaches theoretical without any practical examples, very difficult to implement.

  • @SeddikChannel
    @SeddikChannel 5 лет назад +1

    While front is clear, keep learning. What a fabulous professor.

  • @CaptureLifeWithKaitav
    @CaptureLifeWithKaitav 10 лет назад +6

    Best lecture for learning programming methodology in java !! 5 star :D tysm sir

  • @gabrielreis3701
    @gabrielreis3701 11 лет назад +3

    sahami makes my days happier.

  • @barrywalker1809
    @barrywalker1809 2 года назад +1

    Thank you, Professor Sahami! These lectures are excellent, and still helpful all of these years later, in 2022!

  • @Rosealinda1602
    @Rosealinda1602 10 лет назад +74

    would love it if he was my teacher

    • @dontbeanant
      @dontbeanant 10 лет назад +5

      Took the words right out of my mouth.

    • @danialpun4945
      @danialpun4945 10 лет назад +24

      He is your teacher and of million others and even better than going to class because you can rewind.

    • @xXErr4rXx
      @xXErr4rXx 9 лет назад +1

      +danial pun obviously not, do you get candy or not? DO YOU GET CANDY OR NOT? (which was probably meant for someone else)

  • @dopier12
    @dopier12 8 лет назад +9

    It would have been interesting to see how I would have turned out if I could understand every second of a lecture from even a few of the classes I took during my bachelors program like I understand this class. It's interesting to be able to understand a class from start to finish. It makes for better learning! If only we didn't lose the emphasis on educating in education nowadays!

  • @danoacel
    @danoacel 15 лет назад

    Prof. Mehran knows how to keep his student focus.....great lecture.

  • @Aftenx
    @Aftenx 26 дней назад

    .
    I am learning online from other side of the planet And Professor already giving me diabetes , BTW very exciting class.

  • @andrewmarino5441
    @andrewmarino5441 2 года назад

    This professor is amazing. He makes it easy for simple minded people to even understand

  • @SolidSnakeProductions
    @SolidSnakeProductions 15 лет назад

    I go to the University of Phoenix Axia online and I only wish we had some kind of lecture videos or something like this. I am learning much from these videos! Thanks Stanford U and the Proffesor.

  • @s3aada
    @s3aada 14 лет назад

    Waw.... This Professer Meharan is Amazing. Thank you Stanford for making it possible for every one. I wanna master Java.

  • @rishabhpoddar1
    @rishabhpoddar1 5 лет назад +1

    I so wish there was a way to ask questions to Prof. Mehran, or to students/TAs in his class... I wouldn't even mind paying for this.

  • @qwertyfshag
    @qwertyfshag 14 лет назад

    thanks Stanford for making this possible. Now anyone in the whole world with the internet can view high quality lessons.

  • @karthiksap1000
    @karthiksap1000 11 лет назад

    thanks to Stanford and to the professor for making wordclass educational sessiosn available for everyone in this world!

  • @frokenstein
    @frokenstein 12 лет назад +1

    Mehran RULES! I was in his class when I was at Stanford (a long time ago)

  • @thefanXF
    @thefanXF 11 лет назад

    Best professor in programing so far in my life experience ! Great time watching these

  • @oachava
    @oachava 9 лет назад +138

    intro to programming and diabetis

    • @dg-hughes
      @dg-hughes 7 лет назад +6

      Sugar isn't the cause of diabetes but you crave sugar if you are diabetic.

    • @pauloteixeira763
      @pauloteixeira763 7 лет назад

      Axl Chavatt LOL.

    • @youtubificationizer
      @youtubificationizer 5 лет назад

      Oh wow, I just got to the third video and I made a comment on the 2nd video that was very similiar.

    • @exnihilonihilfit6316
      @exnihilonihilfit6316 4 года назад

      @@dg-hughes You're completely ignorant.

    • @yashwanthreddy1746
      @yashwanthreddy1746 3 года назад

      This is surely coincidence with you and me for some reason

  • @deiu9999
    @deiu9999 12 лет назад

    now that`s what I call a proper professor

  • @Holly_Fae
    @Holly_Fae 10 лет назад +9

    Slingshots work great for the back row....just a suggestion.

  • @drimpossible5078
    @drimpossible5078 8 лет назад +1

    this guys teaching skills are on point

  • @IraqiMelody
    @IraqiMelody 15 лет назад

    Al-Khawarzmy is an Iraqi scientist. He was born in IRAQ-Baghdad and he established Algebra subject as well as develop many methods in Math. and one of his method calls algorithm, and all his books had been translated from Arabic language to Latin and other languages.

  • @willvoiceit1
    @willvoiceit1 14 лет назад

    I've just finished assignment 1, and I have to be honest: watching Karel move around his world until he ends up in the right place - one of the better feelings.

  • @kin5678insane
    @kin5678insane 12 лет назад

    Valid question. The idea is to make a method for each, so if he needed to use them more than once for any reason, he could call it as many times as he wanted without rewriting the code every time.

  • @Smeak686
    @Smeak686 13 лет назад

    Very good instructor. He is very knowledgeable and also very entertaining.

  • @SpeakerFrequer
    @SpeakerFrequer 13 лет назад

    @johnstonmatt it is in the import stanford.karel.* there are many libraries that have pre-defined words to use. It is kinda like a game engine for video games. Video games (provided it is the same engine that is used) have the same code for physics, lighting, ect...There is no point in writing all the code if it is something you are going to use often (with each new game) when you can just call it with the import function.

  • @bigbabyjack
    @bigbabyjack 10 лет назад +2

    Anybody know why when I try and run my program in Eclipse it can't load a Karel world? Help!

  • @MrValzen
    @MrValzen 13 лет назад

    New to programming and this lesson helped a lot in how to approach problems. thanks!

  • @pureiaa_desu
    @pureiaa_desu 10 лет назад +1

    Man i would love su much to be there.... :D
    Thank you for this Stanford.

  • @SprayedToTheBone
    @SprayedToTheBone 12 лет назад

    They are pretty similar although java does some things automatically. For example it has a "garbage collector" which means that it deletes the objects you create from classes automatically whereas in c++ you have to do it manually inside your program.Also c++ uses pointers that point cells in the memory for you variables something that in java is done automatically.

  • @GrammeStudio
    @GrammeStudio 10 лет назад +1

    anyone found the SteepleChase program?
    i only have CheckerBoardKarel, CollectNewspaperKarel, MidpointFindingKarel, and StoneMasonKarel

  • @joevicentini
    @joevicentini 16 лет назад

    Great lecture from Professor Mehran. Thanks Stanford for sharing.

  • @narco73
    @narco73 12 лет назад

    I liked the checkerboard assignment, there was more to it than you would think at first.
    If you do it, check that your answer works on a 1x1 world. (even tho the assignment doesn't explicitly say that it should, but it does imply it)

  • @k3nny111
    @k3nny111 11 лет назад

    I think the difference between specific classes is much bigger than the difference between Netherland and US culture, regarding asking questions.

  • @skolanbrinner
    @skolanbrinner 12 лет назад

    Great programming in general theory, what an amazing teacher.

  • @NgJit
    @NgJit 10 лет назад +2

    in the double beeper function --- Are you doing it this way to iterate the binary base of the math functions? Because it seems to me that the algorithm would be less memory intensive just to count the beepers, spit out a value, call on kerel, get the value of the count, double it, change kerel's number of beepers, move dump them off, move back.

    • @mikejankowiak5434
      @mikejankowiak5434 9 лет назад +1

      Was thinking the same thing lml

    • @MyLittleMagneton
      @MyLittleMagneton 9 лет назад +1

      Ng Jit did you finish watching the video? there was a whole section explaining it.

    • @NgJit
      @NgJit 9 лет назад

      Ya I did

  • @BhathiyaSupun90
    @BhathiyaSupun90 14 лет назад

    WOW....simply outstanding ! thnx STANDFORD ..

  • @intuitivebellydance_pt
    @intuitivebellydance_pt 15 лет назад

    You need to download the assignments as well. Then go to import project under the Stanford menu. When you run the project, you load Karel and its world.

  • @levelxgamescom
    @levelxgamescom 12 лет назад

    Just a heads up, it's generally considered best practice to capitalize the first letter of class names and to lowercase the first letter of method names.

  • @amityadav8812
    @amityadav8812 9 лет назад

    encounter a problem while run any program...dialup box-workspace doesnot contain a main type(do you have a public void run() method?) how can i handle this problem?

  • @benjass8552
    @benjass8552 12 лет назад

    No, any method that is declared private can only be accessed by the class that it's placed in. If he were to move the method moveBackward() outside of the class he would have to mark it public to be able to access it by another class. Hope this helped.

  • @xVerbati
    @xVerbati 13 лет назад

    i like how they give microphones to students asking questions, at first when the first question was asked in this video, i thought we just couldnt hear him.

  • @seanjmee
    @seanjmee 15 лет назад

    @58kungfu If you click on the assignments page of the course website - its a zip file called assignment1 located near the bottom of the page. That contains karel.

  • @CemlynWaters
    @CemlynWaters 3 месяца назад

    Mehran has the best sense of humour!

  • @guptapriyansha
    @guptapriyansha 12 лет назад

    He is such a nice professor. I love watching him :)

  • @archonjubael
    @archonjubael 12 лет назад

    Do you want to code or build? That pretty much sums it up.

  • @quanghung123123
    @quanghung123123 12 лет назад

    I love watchinghim, too.He is really a good professor

  • @AaronBarlow
    @AaronBarlow 12 лет назад

    So wait, could you just "move" and then use the for loop to put beeper 5 times and then move backwards? Wouldn't that remove a couple steps, or is there something I am not understanding?

  • @FootballForLife987
    @FootballForLife987 11 лет назад

    I've tried the first assesment. Problem is, when I want to run it, it says the source attachment does not contain the source for file Karel.class

  • @bonsaiplant6731
    @bonsaiplant6731 11 месяцев назад

    will it slow down your code if you have too many decompositions?

  • @cwm9
    @cwm9 16 лет назад

    Excellent lecture, but I have a beef with the last example in which cleaning is done in both directions.
    The completion conditional within the while loop does not always apply, thus necessitating the final "turnAround" command within the inner else{}.
    One should strive to eliminate such special conditions, if it is reasonably possible to do so, as they can hide bugs.
    In this example, instead of cleaning in both directions, a better solution would be to return to the west side of the next row.

  • @muhammadabdelsalam2162
    @muhammadabdelsalam2162 5 лет назад +1

    شكرا علي هذا الشرح it's very great

  • @joshmuldonian5039
    @joshmuldonian5039 12 лет назад

    QUICK QUESTION, I have recently downloaded the file to install karel on my pc. See the thing is is that im expecting to see an executable but thats not it. So i navigate through "eclipse" and direct it to open the folder karel but not having any luck. Am i missing something?

  • @ImSimplyLegit
    @ImSimplyLegit 12 лет назад

    At 23:35 does it matter if he put private void moveBackward(); in the run class? Could he place the method outside of the class and it still be able to use the method?

  • @PestProductsOnline1
    @PestProductsOnline1 11 лет назад +5

    When i finish this series, im putting on my resume that i took java from Stanford...

  • @maruthgoyal1367
    @maruthgoyal1367 10 лет назад +1

    Can we use integers in the MidpointFindingKarel Problem?

    • @Kryword
      @Kryword 9 лет назад

      Maruth goyal I'm probably a bit too late but you don't need to use integers for that problem. It's possible with an algorithm

  • @daviglaser2005
    @daviglaser2005 11 лет назад

    O jeito que o professor ensina faz com que o aluno aprenda com mais facilidade.

  • @braimahjake
    @braimahjake 14 лет назад

    if every programming institution could teach like this,pple wount be scared to learn programming.

  • @jaheduddin1409
    @jaheduddin1409 8 лет назад

    Can anyone tell me the name of the manufacturer that was producing the "infinite loop execution in 2.5 secs" microchips?

  • @mertzanakia
    @mertzanakia 11 лет назад

    Thank you Mr Sahami.

  • @brownbear696969
    @brownbear696969 11 лет назад

    please help, what handout am i supposed to be on in this video and should i have completed all of assignment 1 already?

  •  4 года назад +1

    42:30 check these things when building a program

  • @J90JAM
    @J90JAM 7 лет назад

    These videos need to be remastered!

  • @noobsaibotmk10
    @noobsaibotmk10 13 лет назад

    @Lemon77UG That happens to any video on RUclips that has a series. Also this professor seems chill.

  • @Lemon77UG
    @Lemon77UG 13 лет назад +7

    Lecture 1: 466,768 views
    Lecture 2: 223,888 views
    Lecture 3: 115,468 views
    By lecture 10 there's 43,187 views and the final lecture has only 28,320 views.
    Hmmmmm...

  • @philipverney5271
    @philipverney5271 12 лет назад

    Ok, so I'd LOVE it if I could follow along, however I have No Idea how to implement the acm package... So when I try compile any one of the projects, I get told that the acm classes are missing etc etc yada yada yada...
    How can I do an import like "import package.class" but with the acm stuff?

  • @trulysick86
    @trulysick86 12 лет назад

    camelCase is standard.. private is for one class only(This is how java can "hide" data), public is for alllll... then you have all sort of classes and classes that abstract, inherit, and extend other classes ;)

  • @Rasmusorum
    @Rasmusorum 15 лет назад

    is there a big difference between the pdf version of "the art and sience of java" book and the full original version? Will i be able to complete the course and understand all the details with the pdf preliminary draft of the book, or will i miss alot of detail if i don't read the final example of the book?

  • @xVerbati
    @xVerbati 13 лет назад +1

    @ralusek I agree, i've tried other java tutorials like that where they start out with just one class and just the main class...the way this college teaches it, is 10x+ better :)

  • @shaikjansaida7128
    @shaikjansaida7128 7 лет назад

    If the lecture was in 3D, then everyone watching this at home would be busy catching those candies

  • @darrenallen773
    @darrenallen773 10 лет назад

    @Jackconner
    did you download the assignment zip files?

  • @salmonxia
    @salmonxia 15 лет назад

    can not see projector screen from computer clearly.

  • @indgairhe
    @indgairhe 14 лет назад

    How can get the handouts that students in this class receive?For study purpose. Studying from home here. thanks

  • @sophiaperides5281
    @sophiaperides5281 10 лет назад

    Eclipse downloads fine from the site, but when I try to open it, I get an error saying
    "JVM terminated. Exit code=1, /usr/bin/jva, etc. Anyone know what's going on?

    • @schmidtzcargolbull
      @schmidtzcargolbull 10 лет назад

      Hi I had the same problem.
      What I did was is download both the Stanford version of Eclipse and the newest version of Eclipse from www.eclipse.org/downloads/‎
      Then I pasted all the files from the features and plugin folders of the Stanford version into the fresh version of Eclipse. I also copied the startup.jar file over.
      Once you've loaded it up, you might get an error, just ignore that and follow the instructions of K"arel in Eclipse" as usual :)

    • @anthonyintheuk
      @anthonyintheuk 10 лет назад +1

      Or you can download Oracle VirtualBox and create a virtual machine on your computer and load Windows XP SP3 on it. Then install Java 1.6 and the Stanford Eclipse version and just do all your work within the virtual machine. This was the avenue I took as Stanford's Eclipse client is not compatible with Windows 8.1 x64 even using the Compatibility Settings. Took me 30 minutes to go from downloading and installing Oracle VirtualBox to having the OS and programs installed and up and running.

  • @unlimitedkejra
    @unlimitedkejra 5 лет назад

    alright, so can somebody please help me out here? in the last program that he teaches, Karel cleans up the last row while it faces East so:
    1. the left would be blocked so it already breaks out of the loop and it doesn't go into the Else part of that condition.
    2. if the world happens to have one more street then Karel would have to end cleaning the last row while moving Westwards, and then only I notice that TurnAround(); comes into action.
    So is this program written in more like a generalized manner so that Karel can do the same job in all types of world environment? Because in that specified world the program never goes into that Else statement.
    Am I right or wrong? Please correct me if I'm wrong I'm a little confused there. Thanks a lot of reading this through.
    -Sandip.

  • @Lemon77UG
    @Lemon77UG 13 лет назад

    @Vaughnlesterinoz: I'm new to this this too, and I get top down design a bit, but this guy does some really nice abstractions in that doubleBeepers program. Nothing like I wrote before looking at the solution (mine is more like in the book).

  • @LifeMushroom
    @LifeMushroom 9 лет назад +4

    Does he still teach at Stanford?

  • @n67tn
    @n67tn 14 лет назад

    at ttodhe the video's are available at the stanford website, search standford engineering everywhere

  • @mohabmohammad164
    @mohabmohammad164 2 года назад

    Where can I find the assignments?

  • @sharkstowinthecup
    @sharkstowinthecup 14 лет назад

    my dream is to go to stanford and if teachers are this good i am so going there

  • @jason4399
    @jason4399 10 лет назад

    Where can we find the handouts and packages if not attending Stanford?

    • @saugaatallabadi
      @saugaatallabadi 10 лет назад

      see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111

    • @msharno
      @msharno 10 лет назад

      cs.stanford.edu/people/eroberts/courses/cs106a/handouts/

  • @CanisLupus1987
    @CanisLupus1987 15 лет назад

    I love the way he refers to infinite loops. I never rationalized the shampoo instructions as an Infinite loop....

  • @LuisArteaga007
    @LuisArteaga007 12 лет назад

    Did you do all the steps described in the "05-downloading-eclipse.pdf" and "06-karel-in-eclipse.pdf"? I recommend you to delete Java and your current eclipse version and try it again step by step with the pdf-guides.

  • @MrBlackspoon
    @MrBlackspoon 11 лет назад

    One thing I see what differs with my programming classes in the Netherlands is, the students ask more questions in America.