Chapter 2: Programming in Alice

Slides:



Advertisements
Similar presentations
Mike Scott University of Texas at Austin
Advertisements

Princess & Dragon – Version 2 By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Part 2: Using Methods.
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
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.
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,
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
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.
Creating An Animation Program Part 2 Alice. Method A segment of program code (instructions) that defines how to perform a specific task.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
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.
Lists Tutorial By Deborah Nelson Duke University Professor Susan Rodger July 13, 2008.
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.
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: the Dummy Marker Typically used for: Positioning large and small objects in a scene Remembering camera positions for multiple scenes Remembering.
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.
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.
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
Programming in Alice Chapter 2.
Classes, Objects, and World-level Methods
Skater World: Part Four
A Simple Quiz for Alice 3.2:
An Introduction to Alice (Short Version)
Teaching Characters to Walk: Learning Methods, Part 1
Starting Out with Alice: A Visual Introduction to Programming
Professor Susan Rodger
Getting started in Alice
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
Putting Objects in Motion
Changing Camera Views! Part 1: Set Point of View to By Bella Onwumbiko
The Alice Interface.
Changing Color, Using Text Objects, and Random Selection in Alice
Using Procedures and Exception Handling
Introduction to Events
World-level Methods with Parameters
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Classes, Objects, and World-level Methods
Chapter 1: Introduction to Alice and Objects
Alice in Action with Java
A Simple Quiz for Alice 3.2:
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events
An Introduction to Programming Using Alice 2.2, Second Edition
Introduction to Object-Oriented Programming in Alice
Headshots in Alice Duke University Professor Susan H. Rodger
Alice and Daisies: Positioning and Moving Objects in Alice
under the direction of Professor Susan Rodger
Presentation transcript:

Chapter 2: Programming in Alice Starting Out with Alice: A Visual Introduction to Programming Third Edition

Writing Methods What is a method? set of instructions that execute 2.1 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 my first method

2.1 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.

2.1 world.my first method Methods play the instructions (tiles) that are dragged into the Method Editor

dot notation: hare.move 2.1 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 dot notation: hare.move

Terminology argument argument method object editing tag 2.1 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 argument argument method object editing tag

Editing Tag Holds additional arguments 2.1 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)

Deleting Right-click the instruction and select delete 2.1 Deleting Right-click the instruction and select delete Drag the instruction tile to the trash can

Copying Right-click the instruction and select copy 2.1 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

Methods and Primitive Methods Tasks Complete the following Create Tutorial 2-1 on pages 62-64 Complete the Exploring Primitive Methods tutorial(2-2) on page 67-69

2.1 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?

Which one coaches the Knights and which one coaches the Cougars? 2.2 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?

Renaming Objects Methods 2.2 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.

2.3 Designing a Program Design the program Write the methods Test the methods Debug the methods Design requires planning…that follows the above steps Called program development cycle Cycle is repeated until there NO errors appear in the program.

Designing the Program Determine what the world is supposed to do. 2.3 Designing the Program Design the program Write the methods Test the methods Debug the methods Determine what the world is supposed to do. Use problem statement that describes the objects that will appear 15

2.3 Designing the Program Design the program Write the methods Test the methods Debug the methods Break the problem statement down into series of steps Pseudocode Flowchart 16

2.3 Writing the methods Design the program Write the methods Test the methods Debug 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 17

Testing Test to make sure it meets the following criteria: 2.3 Testing Design the program Write the methods Test the methods Debug the methods 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. 18

2.3 Designing a Program Design the program Write the methods Test the methods Debug the methods 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 19

Comments //comment tile A comment is a note explaining the code 2.4 Comments 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 //comment tile

Tips for Setting Up the Initial Scene 2.5 Tips for Setting Up the Initial Scene 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

Using The Program Design Cycle Pay close attention to the instructions along with the problem statement, flowchart and pseudocode found on pages 82-83 before jumping straight into the program. Complete Using the program design cycle tutorial(2-3) on page 82-87 Complete the Tutorial 2-4 over inserting comments into Alice.

Tips for Setting Up the Initial Scene 2.5 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) 23

Tips for Setting Up the Initial Scene 2.5 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) 24

Tips for Setting Up the Initial Scene 2.5 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 25

Cinderella Needs Our Help Comments Please!!!!! 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. Complete and show Mr. Smith how you can move the camera and objects around in Alice from the main sections on pages 94-96(Object to Center of the world, position objects a specific distance apart and moving the camera to an object.

Executing Instructions Simultaneously 2.6 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

The Do in order Structure 2.6 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

Loops Complete the tutorial 2-5 on pages 98-102 to reinforce the concept of looping within Alice.

Challenge Yourself Students will complete four basic skills program and two challenge programs from the exercises at the end of the textbook. Students will choose four(50 points each) of the following to complete from pages 109 – 111. -Exercise 1,3,5,6,10 Students should choose two(100 points) of the following challenge programs 8,10 or 12

Skills Test Students will complete exercise 11 from page 111. - 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).