Problem Solving Programming Where are we Problem Statement
Problem Solving & Programming
Where are we? Problem Statement Understand the problem Test the code Design a solution Implement the design
Recall: Design � Algorithm Do in order penguin move forward (to the ball) penguin swagger penguin pushes the bowling ball so it rolls to the pin falls over pin responds (stands up and pushes the ball back to penguin) penguin falls over � Initial Scene
Step 3: Implementation Ø Implementation is the act of translating an algorithm/storyboard into a computer program. Ø To Translate Ø Decompose algorithm step by step Ø Incrementally develop and test program statements
Step 3: Implement the design Ø Decompose Problem Statement Understand the problem Test the code Develop a storyboard / algorithm Design a solution Implement the design Decompose into simple steps
Incremental Development Ø Write code Problem Statement Understand the problem Test the code Write statements (code) – a few steps at a time, not the entire program at once! Design a solution Implement the design Decompose into simple steps
Penguin move… Do in order penguin move forward (to the ball) penguin swagger penguin pushes the bowling ball so it rolls to the pin falls over pin responds (stands up and pushes the ball back to penguin) penguin falls over 12/17/09
Creating a statement �A statement is created by dragging a code tile into the edit space
Same actions … two editors One-shot in Scene setup Actions useful for setup Statement tiles in Code editor Same actions and more
Step 5: Test and Revise, if needed Problem Statement Try different values (distance, direction, revs) Understand the problem Revise? Design a solution Revise? Test the code Does it work, no matter what? Implement Revise?
Testing � When Run… button is clicked ◦ Alice builds the scene for the runtime window ◦ Executes the program statements, starting with the my. First. Method procedure (defined in My. Scene) Runtime window
Penguin swagger Do in order penguin move forward (to the ball) penguin swagger penguin pushes the bowling ball so it rolls to the pin falls over pin responds (stands up and pushes the ball back to penguin) penguin falls over Where is the swagger tile?
Decompose � Break an action into simpler steps Do in order penguin move forward penguin swagger penguin pushes the bowling ball so it rolls to the pin falls over pin responds (stands up and pushes the ball back to penguin) penguin falls over penguin roll left penguin roll right penguin stand up straight 12/17/09
Next… � Creating our own procedures - or - � Teaching a penguin to swagger
- Slides: 14