Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2: Programming in Alice

Similar presentations


Presentation on theme: "Chapter 2: Programming in Alice"— Presentation transcript:

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

2 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

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

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

5 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

6 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

7 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)

8 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

9 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

10 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

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

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

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

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

15 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

16 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

17 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

18 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

19 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

20 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

21 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

22 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 82-87 Complete the Tutorial 2-4 over inserting comments into Alice.

23 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

24 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

25 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

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

27 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

28 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

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

30 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

31 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).


Download ppt "Chapter 2: Programming in Alice"

Similar presentations


Ads by Google