ch02 - Alice in Action with Java Chapter 2 Methods...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Alice in Action with Java Chapter 2 Methods
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alice in Action with Java 2 Objectives Build world-level methods to help organize a story into scenes and shots Build class-level methods to elicit desirable behaviors from objects Reuse a class-level method in multiple worlds Use dummies to reposition the camera for different shots within a scene Understand how an object’s position , orientation , and point of view are determined
Background image of page 2
Alice in Action with Java 3 Methods Programs consist of a set of statements Method: behavior-producing message Objects have predefined methods for basic tasks Methods may also be created by Alice developers Two reasons for building your own methods To organize your story into more manageable pieces To provide an object with additional behaviors
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alice in Action with Java 4 World Methods for Scenes and Shots Scene: segment of a story Shot: part of a scene from a given camera position User stories can be divided into scenes and shots A convenient technique for completing a project Divide and conquer approach to building user stories Break a big problem into smaller problems Solve each of the smaller problems Combine the smaller problems into a solution
Background image of page 4
Alice in Action with Java 5 Methods for Scenes Scenario: develop a user story with three scenes Convention for naming methods Name should be a verb or verb phrase Name should describe what the method does Creating the first new method Select the world object Click the create new method in the details area Enter playScene1 in the New Method dialog box Check new method by sending say() to ground First test fails because my_first_method() is empty
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alice in Action with Java 6 Methods for Scenes (continued)
Background image of page 6
Alice in Action with Java 7 Methods for Scenes (continued)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alice in Action with Java 8 Methods for Scenes (continued) How to fix the first bug Click on the tab for my_first_method Drag a doInOrder control to the top of the pane Click on world in the object tree Drag playScene1() into the doInOrder statement Extend technique used to build playScene1() Add two methods: playScene2() , playScene3() New method sends a say() message to the ground New Methods are called in my_first_method()
Background image of page 8
Alice in Action with Java 9 Methods for Scenes (continued)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alice in Action with Java 10 Methods for Scenes (continued)
Background image of page 10
Alice in Action with Java 11 Methods for Shots Scenes can be divided into shots Shots can be further divided into pieces Reasons for using scenes, shots, and pieces To create a program that reflects the user story To create a program that has a modular design Example of a scheme using scenes and shots Level 1: my_first_method() Level 2: three methods for three scenes Level 3: four methods for four shots in Scene 2
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/27/2008 for the course INSY 3300 taught by Professor Wang during the Spring '08 term at UT Arlington.

Page1 / 51

ch02 - Alice in Action with Java Chapter 2 Methods...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online