1 / 27

Lecture 5: Finishing 4.3 and onto 5.1

Lecture 5: Finishing 4.3 and onto 5.1. Preparing for the Midterm: Written Explanations Technology and Society Assignment (5% - 3 in term) How does the internet work? You can figure it out! Due Wednesday Week 4 See moodle (let’s look) Thursday Office Hours Moved this week 1-2pm.

wayne
Download Presentation

Lecture 5: Finishing 4.3 and onto 5.1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 5: Finishing 4.3 and onto 5.1 • Preparing for the Midterm: Written Explanations • Technology and Society Assignment (5% - 3 in term) • How does the internet work? You can figure it out! • Due Wednesday Week 4 • See moodle (let’s look) • Thursday Office Hours Moved this week • 1-2pm

  2. Group Discussion:Practice for the “Real World”! • Discussion on the exam? • Written explanations of multiple choice question answers • Remember the eskimoGirl jumping and saying Hello?

  3. How would we change the code to make her say Hello while jumping up and down?

  4. What makes a good explanation? • Shows English expression of understanding – not just reading what the code does. • Uses appropriate terminology (DoTogether, method, etc.) • Explains why incorrect answers are wrong.

  5. Good explanations: Clear understanding of how the code performs • We need things to happen simultaneously so we’ll use a DoTogether tile. However, if we want the eskimoGirl to jump up then down, we need a DoInOrder tile within the DoTogether tile. Without a DoInOrder tile, the methods move up and move down will occur at the same time, causing the eskimoGirl to do nothing.

  6. Good explanations: Summary plus option comparison • D) None of the above. The storyboard we want is an eskimoGirl jumping up and down WHILE saying hello. • In option A), the girl says hello first, then jumps up and down. • In option B), the girl jumps up, then says hello as she comes down. • In option C) it would be correct except the eskimoGirl moves down then up. • The correct answer is like C – with a DoTogether tile with the say hello happening together with “jumping” – which we implement with a DoInOrder tile with move up then move down

  7. Which of the following is the best definition of a class-level method? • A method that controls an ice-skater • A method that belongs to a particular object • A method that takes parameters to control how it works • A method that you need to be sure to save in order to be able to use it in the future

  8. The somewhat complex steps of having a skater spin around were managed by what technique: • Use of parameters to control the action • Stepwise-refinement to create multiple levels of methods • Class-level methods to support development of a new cleverSkater class • Use of primitive methods pre-built into the Alice software

  9. What are the correct names for the underlined terms?

  10. The area indicated below contains what? • My First Method because that’s what is always done first • An event -- a mouse click or key press • An event handler method • A parameter

  11. Building my OWN flight simulator:What will the plane do when the right arrow button is pushed? • Turn left • Turn right • Alice will complain that there is a logic error • I don’t know

  12. Parameterization: Changing from specific to more general • sayHelloToAlien -> sayHelloTo • Made the object of “who” we want to say hello to a parameter • sayHelloTo -> sayTo • Add a 2nd parameter to make even more useful in more situations • Maybe you don’t ALWAYS want to say hello!

  13. Parameterization Done! • Very specific class-level method with no parameters • Class-level – owned by talkativeSpiderRobot class • An action that applies to talkativeSpidertRobots • Added 2 parameters to make it more flexible/control how it behaves • Object: Who to talk to • String: What to say • Next: Deeper analysis of things people get confused about with class-level methods

  14. EXAM PREP:Which of the following is the best explanation of what makes a good parameter • It’s something that supports common variation in how the method is done • It’s got a meaningful name • It can be either an Object or a number • It helps manage complexity in large programs

  15. Suppose we have the following world with 2 objects of the talkativeSpiderRobot class What code will make this happen?

  16. Which method call will make this happen? (play animation) C) Both of those method calls do that same thing

  17. Class-level methods (e.g. skater methods, talkativeSpiderRobot methods) cannot have an object type parameter • True, they have to only act on the object of the class they belong to (e.g. skater, tSR) • True, class level methods can’t have any parameters • False, they can take as parameters another object they may interact with • False, they must always take an object parameter of the class they belong to (e.g. skater,tSR)

  18. Small variation: Make both objects turn to face each other

  19. In lab, Maria says: “What I did was I used the parameter of SayToand made it the calling object a call to the turnToFace method”

  20. Frank is trying to follow along: “Wait, you said whoTo was a parameter here, why did you call it a calling object here?”

  21. Maria says… • Sorry, I mis-spoke, whoTo is a parameter, and that’s what we should call it • Because names can depend on the context in which they are used (e.g. the sayTo method or the turnToFace method) • Because names are determined by location: one place it comes after the method name and in one place it comes before the method name

  22. Yes, one “thing” can have two names:It depends on the CONTEXT

  23. Why do we care what these things are named and why we name them different things in different places? • After this class: calling object vs parameter • Probably not important • What is important • Recognizing the specificity that can be critical in communicating about technical issues • Taking care to interact effectively with others when discussing technical issues • Especially when they are LESS or MORE familiar with the given technology than you

  24. Have you ever had an experience where miscommunication regarding a technical issue caused problems?(maybe fixing a problem,trying to get software to work, etc.) • Yes • No • I don’t know what you are talking about

  25. Opacity and Is Showing • Properties of objects, useful for nice effects and to make things “appear” later in animations • No existing methods in method list • Click on properties tab and drag that property pane into program, choose a value and it will call a “set to” method on that property • Every property can be set with a “set to” method in your program

  26. Chapter 5: Interactive Worlds with Event Handling • Instead of having “animation” controlled by a specific method (every time) – like my first method • Control can vary based on a set of possible “events” • Create an event link to a method • Multiple methods can link to same event – but perhaps with different parameters • What code runs when you hit play? • Essentially a method “listening” for you to click or push a button – it listens over and over again

  27. Identify the parameters in the following event link

More Related