|
1 | 1 | package org.teachingkidsprogramming.recipes.inDevelopment; |
2 | 2 |
|
3 | 3 | import org.teachingextensions.logo.Tortoise; |
4 | | -// NOTE: this might need to be broken into several different recipes?? |
5 | | -// e.g. PyramidsOfGiza01, PyramidsOfGiza02, PyramidsOfGiza03, etc... |
6 | | -// This is a very simple/basic recipe introducing passing multiple values |
7 | | -// into methods and reinforcing basic refactoring. |
8 | | -// This can be completed in several 'passes' or 'steps of refactoring' as follows: |
9 | 4 | // |
10 | | -// 1. entire recipe written in linear fashion with lots of repeated code |
| 5 | +// 1. This recipe written in linear fashion with lots of repeated code |
11 | 6 | // 2. a) turnAndMove() method created |
12 | 7 | // b) every 2 linear turn() and move() calls are replaced by 1 call to new turnAndMove() method |
13 | 8 | // 3. Now another pattern emerges, and a 3rd refactoring/abstraction takes place |
14 | 9 | // when the student notices that there are several each of |
15 | | -// turnAndMove(90, 100) & turnAndMove(-90, 100), so 2 new methods are written: |
16 | | -// turnAndMove(90, 100) becomes -> moveDown() & turnAndMove(-90, 100) -> moveUp() |
| 10 | +// turnAndMove(90, 100) & turnAndMove(-90, 100), so 2 new methods are written: |
| 11 | +// turnAndMove(90, 100) becomes -> moveDown() & turnAndMove(-90, 100) -> moveUp() |
17 | 12 | // 4. At this point, students are encouraged to see if there might be any other possible patterns |
18 | 13 | // to refactor |
19 | 14 |
|
20 | | -// Where to add? In Course 1 or Course 2 - concepts taught: refactoring |
| 15 | +// Where to add? In Course 1 or Course 2 - concepts taught: method arguments (variables) and refactoring |
21 | 16 | public class PyramidsOfGiza |
22 | 17 | { |
23 | 18 | public static void main(String[] args) throws Exception |
|
0 commit comments