Chapter 2 Program Design - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Chapter 2 Program Design

Description:

Design an animation using storyboards (drawings or textual) and possibly ... traveling through space, a robot-manned craft has just made a breathless landing ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 11
Provided by: wand85
Category:

less

Transcript and Presenter's Notes

Title: Chapter 2 Program Design


1
Chapter 2 Program Design Implementation

2
Creating an Animation
  • Given the description of a
  • story,
  • game,
  • simulation
  • create an Alice animation
  • Or
  • Given a problem statement, write a program to
    solve it

3
Creating an Animation
  • Recommended approach
  • Read the scenario (requirement statement)
  • Design an animation using storyboards (drawings
    or textual) and possibly flowcharts
  • Implement your design (translating your design
    into a programming language Alice)
  • Test your design (run your program and evaluate
    the result does it work as required?)
  • If the animation is not correct or complete
    repeat this process appropriately

4
Example
  • Read the First Encounter scenario
  • After traveling through space,
  • Design
  • From the scenario, determine the problem to be
    solved
  • What is the story to be told?
  • What objects are required?
  • What actions are needed?
  • Use the storyboard technique to outline a
    solution
  • Implementation
  • Create an initial scene
  • Translate the storyboard actions into code
  • Test
  • Determine if the implementation meets the
    requirements of the scenario

5
Creating Your First Animation
  • First Encounter scenario (from text)
  • After traveling through space, a robot-manned
    craft has just made a breathless landing on the
    surface of the moon. The robot has already
    climbed out of the lunar lander and has set up a
    camera so earthbound scientists in Houston can
    view this historic event. Through the camera we
    can see the robot, the lunar Lander and some
    nearby rock formations. Suddenly an alien peeks
    out from behind a rock and looks at the robot.
    The robot is surprised and rotates its head all
    the way around. The robot walks over to take a
    closer look and the alien hides behind the
    rocks. Finally, the robot looks at the camera,
    signals danger, and says Houston, we have a
    problem?

6
Storyboards
  • When planning a program we can create storyboards
    to organize our approach. Two forms you might
    use
  • Visual
  • hand-sketched
  • screen captures
  • Textual
  • Algorithm
  • Pseudocode

7
Storyboards
  • The texts textual storyboard

Do the following steps in order alien moves
up alien says "Slithy toves?" robot's
head turns around robot turns to look at
alien Do the following together
robot moves toward the alien robot legs
walk alien moves down,
  • The above outlines an algorithm a set of
    instructions to follow to accomplish a task
  • The above is also referred to as pseudocode it
    is very close to program statements

8
Flowcharting
  • A designer/programmer might use a flowchart to
    illustrate her/his design

A
start
Robot turns to look at alien
Alien moves up
Alien says Slithy toves?
Robots head turns around
Robot says Houston
A
stop
9
Your First Program
See class demo Note how the animation is
developed piece by piece - incrementally
  • Implementing the design
  • Select a world
  • Choose your objects
  • Create an initial scene
  • Edit World.my first method
  • create instructions using objects, methods,
  • Do in order
  • Do together
  • If/Else
  • Loop
  • While
  • For all in order
  • For all together
  • Wait
  • Print
  • // comments

10
Your First Program
See class demo
  • Testing your implementation
  • Play your world
  • Observe the behaviour
  • Is the behaviour what you expected?
  • If yes then you are done
  • Otherwise you have a bug and you need to
  • Determine what needs to change
  • Is the scenario correct?
  • Is your design correct?
  • Is your code correct?
  • Make the changes and repeat this whole process
    again
Write a Comment
User Comments (0)
About PowerShow.com