Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.

Slides:



Advertisements
Similar presentations
Mike Scott University of Texas at Austin
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
PIIT Computer Science Summer Camp - Alice July 10, 2012 Brenda Parker Computer Science Department MTSU.
Coloring Randomly: Random Selection in Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008.
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Exam Wednesday No inclass assignment this week. Friday labs will help with individual homework assignment due Friday midnight Review for exam –Tuesday.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Programming in Alice Chapter 2. Today’s Agenda Designing a Program Writing Methods Executing Instructions Simultaneously Comments Tips for Setting Up.
Exploring Events. Try this Start Alice and create a blank world using the grass template. Add an instance of a BlueBallerina. Add an instance of a PinkBallerina.
Chapter 2: Input, Processing, and Output
Programming in Alice Chapter 2 Part 2. Events Editor Identifies what method is executed (run) when the “Play” button is hit 2.
Classes, Objects, and World-level Methods Alice. Programming in Alice© 2006 Dr. Tim Margush2 Class / Object Class A template describing the characteristics.
Copyright 2011 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Implementation Algorithm  Code World.my first method Control blocks Statements (methods,
METHODS!.  A method is a sequence of instructions or behaviors that will be carried out when requested.  You can use them to create new methods so that.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley This week: Whew!!! The last homework was tough! The homework for this week.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
Programming Logic Program Design. Objectives Steps in program development Algorithms and Pseudocode Data Activity: Alice program.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
3–D Helium Molecule Tutorial Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
XP New Perspectives on Microsoft Word 2002 Tutorial 31 Microsoft Word 2002 Tutorial 3 – Creating a Multiple-Page Report.
CS329e – Elements of Visual Programming Implementing Programs Mike Scott (Slides 2-2)
Teaching a character to walk in more than one world: Parameters and Inheritance. By Lana Dyck under the direction of Professor Susan Rodger Duke University.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Exam scores by range 3-1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Where are we? Alice is a “toy” language Fundamentals are exactly like “real”
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
An Introduction to Alice (Short Version) – Extras! Yossra Hamid Under the Supervision of Professor Susan Rodger Duke University, June 2014 This is a continuation.
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1,
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Creating a Historical Tour in Alice By Jenna Hayes May 2010.
Alice 3.0 A Guided Tour Mike R-D YRDSB. Agenda General Walkthrough of Alice 3.0 Loops, Variables, Threads Methods / Properties Arrays Misc.
Review for test! Alice Chapter 1&2 Test is tomorrow! - March 26 th March 25th.
Changing Camera Views! Part 1: Set Point of View to By Bella Onwumbiko under the direction of Professor Susan Rodger Duke University July 2013 Updates.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Skater World: Part Four By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1, 2009.
Alice: A Free 3D Animation World for Teaching Programming.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Headshots in Alice Duke University Professor Susan H. Rodger Gaetjens Lezin July 2008.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events By Elizabeth Liang under the direction of Professor Susan Rodger Duke University June.
Presenter: Carol Liss Timberlane Regional Middle School 6 th and 7 th grade Tech. Educator Co presenters:
An Introduction to Programming Using Alice 2.2, Second Edition Chapter 7 Recursive Algorithms.
Chapter 2: Programming in Alice
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
Programming in Alice Chapter 2.
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
Changing Camera Views! Part 1: Set Point of View to By Bella Onwumbiko
The Alice Interface.
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Classes, Objects, and World-level Methods
Tutorial 3 – Creating a Multiple-Page Report
Chapter 2: Programming in Alice
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
An Introduction to Programming Using Alice 2.2, Second Edition
Introduction to Object-Oriented Programming in Alice
Presentation transcript:

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition by Tony Gaddis Chapter 2: Programming in Alice

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Writing Methods What is a method? –set of instructions that execute –create methods by dragging tiles into the Method Editor –these tiles are the instructions 2-2 my first method 2.1

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Naming Conventions dot notation world.my first method dot (period) separates pieces of information left side: object that the method belongs to in this case…the method belongs to the WORLD object right side: name of the method in this case… “my first method” 2-3 the period is called a “dot” 2.1

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley world.my first method Events Editor identifies which method plays or is acted upon when the “Play” button is hit An Error might appear if this section is blank

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley world.my first method Methods play the instructions (tiles) that are dragged into the Method Editor

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Primitive Methods All objects have a common set of built-in method for performing actions. These “primitive methods” all objects to move, turn, change size, and more. Example: Hare has primitive methods to move, turn, roll, resize, say 2-6 dot notation: hare.move 2.1

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Tutorial Design Practicing Using Methods Create Tutorial 2-1 on pages

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Terminology Calling the method: executing a method Argument: piece of information that a method needs in order for it to execute hare.move…which direction? the direction…up, down, left, right…is the argument Passing the Argument: the method is called and the arguments are presented 2-8 object method argument editing tag 2.1

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Editing Tag Holds additional arguments What appears depends on the method called duration specifies amount of time for action to take place default (1 second)

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Deleting Right-click the instruction and select delete Drag the instruction tile to the trash can

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Copying Right-click the instruction and select copy Drag the instruction tile to the clipboard when the clipboard turns green, drop the tile click on the clipboard and drag it back to the Method Editor

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Primitive Methods Task Complete the Exploring Primitive Methods tutorial(2-2) on page Add three other enhancements to the scene. 2-12

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Custom Methods In addition to primitive methods (the things that ALL objects can do)…some objects have custom methods When objects is selected from gallery, a listing of custom methods appears Names of the custom methods give clues as to what the method does What do you think the foottap custom method does? 2.1

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Naming Conventions Names are known as identifiers…because they identify items in a program Use a name that provides meaning Name of method should indicate the method’s purpose Which one coaches the Knights and which one coaches the Cougars?

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-15 namingConventions Most programming languages do NOT recognize spaces –Alice allows spaces but this is not a preferred method. method.my first method Since spaces are not a good technique in programming, how do you combine more than one word in naming? –Capitalize subsequent words –Called camelCase 2.2 Note the space Which is easier to read? onehumpcamel or oneHumpCamel

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Class Names method names begin with a lower case letter Class names are capitalized No spaces, so each word is capitalized This convention is called PascalCase

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Renaming Objects Right-click object’s tile in the object tree and select rename. Methods Select the world object Select the method’s tab from the Details Panel Right-click the my first method tile and select rename

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing a Program Design requires planning…that follows the above steps Called program development cycle Cycle is repeated until there NO errors appear in the program Design the programWrite the methodsTest the methodsDebug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing the Program Determine what the world is supposed to do. Use problem statement that describes the objects that will appear Design the program Write the methodsTest the methodsDebug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing the Program Break the problem statement down into series of steps –Pseudocode –Flowchart Design the program Write the methodsTest the methodsDebug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Writing the methods Design steps (pseudocode or flowchart) provides model for writing the methods Drag tiles into Method Editor to assemble instructions Instructions should follow the order of the Design steps Pseudocode and flowchart may NOT be at the detail of the final instructions Design the program Write the methods Test the methodsDebug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Testing Test to make sure it meets the following criteria: –Does it do what it was intended to do? –Does it have any errors? Or undesired results? –Is it efficient? Are there unnecessary steps? If the criteria are NOT met, then debugging occurs Debugging means to determine what must be corrected or modified to get the program to work correctly Design the programWrite the methods Test the methods Debug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Designing a Program Debugging means to determine what must be corrected or modified to get the program to work correctly Logical errors (bug) is a mistake that produces an incorrect result, but the program still runs. –Instructions in an incorrect order may produce incorrect results –Passing incorrect values as arguments can cause logical errors Design the programWrite the methodsTest the methods Debug the methods

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using The Program Design Cycle Pay close attention to the instructions along with the problem statement, flowchart and pseudocode found on pages before jumping straight into the program. Complete Using the program design cycle tutorial(2-3) on page

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Custom Program Design Task Students will design a flowchart or pseudocode that will include at least twenty different changes within a program of his/her choosing. -After the flowchart or the pseudocode have been approved students should design the program within Alice by taking the flowchart or the pseudocode and turning them into functional parts within a program. Example 1 Change : White Rabbit moves forward to a position in front of the car 2-25

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Comments 2-26 A comment is a note explaining the code Crucial part of the code Makes the code understandable Alice ignores comments when it plays your program 2.4 // comment tile

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Comments Please!!!!! Complete the Tutorial 2-4 over inserting comments into Alice on page

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Tips for Setting Up the Initial Scene 2-28 Use the primitive methods to setup the scene –Select the object in the Object Tree, then select a method Use the primitive methods to position the objects –Doing so from the Object Tree positions the objects outside of the program 2.5

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Cinderella Needs Our Help Look at pages 93 and 94. Insert a new Cinderella Object Perform the three steps on pages 93 and 94 to move Cinderella's hands to her side using methods. 2-29

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Tips for Setting Up the Initial Scene Moving an object to the center of the world –Use the move to method and choose the entire world as the method’s argument –Places the object’s center point at the world’s center point of (0, 0, 0)

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Tips for Setting Up the Initial Scene Positioning objects a specified distance apart –Use the move to method and choose asSeenBy the other object for the method’s argument –Places the object’s center point at the world’s center point of (0, 0, 0)

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Tips for Setting Up the Initial Scene Moving the camera to an object –Right-click the object and choose Camera get a good look at this –Camera moves to a position so the object is in plain view

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Executing Instructions Simultaneously By default, instructions are executed one after the order…in the order they appear in the Methods Editor For simultaneous actions, drag Do together into the Methods Editor Other instructions can be place within the Do together tile Make sure the duration for all items in Do together are the same

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Do in order Structure By default, all instructions are performed in order they appear in the Methods Editor Do in order structure used when more than one set of actions must occur simultaneously…but has steps that must be done in order

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Loops Complete the tutorial 2-5 on pages to reinforce the concept of looping within Alice. 2-35

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Exporting Code for Printing 2-36 Code can be exported to an HTML file –Open the file and Print From File – Choose Export Code for Printing YOU must add your name as the author –Author’s name is printed with the exported code 2.7 Author’s name

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Exporting an Alice World to Video An Alice world can be exported to video and shared with others on the Internet Open the File menu and select Export Video You are required to save your world by clicking the Save button Click the Record button to start recording and the Stop Recording button when you are finished Name your video and click the Export Video button Video will be created in the same location where you saved the Alice world 2-37

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Challenge Yourself Students will complete three basic skills program and one challenge program from the exercises at the end of the textbook. Students will choose three(50 points each) of the following to complete from pages 109 – Exercise 1,3,5,6,10 Students should choose one(100 points) of the following challenge programs 8,9 or

Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Skills Test Students will complete exercise 11 from page Students will select a scene from their favorite movie(school appropriate) and then use Alice to recreate the scene with the dialog, sound and movement from the movie. -Students will have 4 days to complete the design of the movie scene. -The movie scene will count as a proficiency measure grade(100 point test grade). -An algorithm or flow chart will be required to outline the scene otherwise the scene will not be accepted for a grade. 2-39