
4.4. Logo Part 1¶
This lesson reinforces the use of procedures as abstraction in programming, but introduces how procedures can help reduce the complexity of algorithms. Students use an app based on the Logo programming environment that has pre-defined procedures to move a turtle around the screen and draw lines. Through a series of drawing exercises, students will be encouraged to use procedures to define each exercise, or parts of an exercise.
CSP Framework | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||||||||||||||||||||||||||||
Enduring Understanding AAP-2: The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-2.K.a: For iteration: a. Write iteration statements. Learning Objective AAP-2.K.b: For iteration: b. Determine the result or side-effect of iteration statements. | |||||||||||||||||||||||||||||||||||||||||
Enduring Understanding AAP-3: Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-3.D: Select appropriate libraries or existing code segments to use in creating new programs. | |||||||||||||||||||||||||||||||||||||||||
Professional Development
The Student Lesson: Complete the activities for Mobile CSP Unit 4 Lesson 4.4: Logo Part 1.
Materials
- Presentation system (LCD projector/Interactive whiteboard)
- Access to computer, laptop, or Chromebook (install the Companion app on Chromebooks)
- Access to mobile device with the Companion app installed or access to the emulator installed on the computer or laptop.
- Logo Part 1 Tutorial (Video, Full Text Version, or short handout)
- Graphing paper - You can print graph paper from www.printablepaper.net
4.4.1. Learning Activities¶
Estimated Length: 90 minutes
- Hook/Motivation (5 minutes): Ask students to think about what basic commands are needed to have the "turtle" draw a square in this historical turtle video or modern Lego EV3 video. (Most likely they will come up with forward and turn.) Ask them to brainstorm other shapes that could be drawn using those commands.
- Experiences and Explorations (30 minutes):
- Explanation (5 minutes): Introduce the Logo environment in App Inventor and explain the primitive operations. The primitive operations are the basic commands that the Android understands before being taught new commands (by defining procedures). Note: The original Logo uses a turtle. In our App Inventor version of Logo, an Android is used.
- forward - moves the Android forward by 10 pixels.
- turn - causes the Android to turn right by 90 degrees.
- setPenUp(True) - pulls the pen off the canvas so nothing is drawn when the Android moves.
- setPenUp(False) - puts the down on the canvas so it will draw.
- setTurtle(True) - makes the Android visible.
- setTurtle(False) - makes the Android invisible.
- draw - moves the Android according to the code you specify. Here is where you will put your algorithms.
- reset - clears the canvas and moves the Android back to it’s starting position.
- Algorithm Practice (10 minutes): Have the students create and write down an algorithm (i.e. how would they use forward and turn) to draw a 10 x 10 square and then display one of their algorithms on the board. Discuss how this is an algorithm. (See note in Background Knowledge about algorithms vs. recipes.)
- Programming Tutorial (20 minutes): Use the video or text tutorials or lead your students to do the first drawSquare exercise. Then have students work in pair programming (taking turns being on 1 computer) or buddy programming (on two computers but making sure they solve it together) to complete the rest of the exercises on their own.
Note that the primitives in this tutorial (forward, turn) are made deliberately weak in the hopes that students will experience some frustration that will lead them to propose something like adding parameters to the procedures. For example, to draw a 30 x 30 square would require the following steps (where F stands for forward and T stands for turn):
F F F T F F F T F F F T F F F T
However, as they will see in the next lesson, if we use parameters, where forward becomes forward(N) so that you can say forward(30) or forward(100) to move the Android forward by a specified distance, then the algorithm for a 30 x 30 square becomes:
F(30) T F(30) T F(30) T F(30) T
- Explanation (5 minutes): Introduce the Logo environment in App Inventor and explain the primitive operations. The primitive operations are the basic commands that the Android understands before being taught new commands (by defining procedures). Note: The original Logo uses a turtle. In our App Inventor version of Logo, an Android is used.
- Rethink, Reflect and/or Revise (10 minutes): Review of terms from today and prior labs: Algorithms, Procedures, Abstraction. See the Logo 1 exercise solutions below in the Assessments and Solutions section. Students should write a reflection on their portfolio and complete the interactive exercises.
Procedures and Parameters: In anticipation of the next Logo lesson, it might be useful in this lesson to discuss the power that procedures and parameters give us. Discuss how the practice of defining a procedures is a way of extending the language by incorporating a richer set of constructs (abstraction). Procedures enable us to encapsulate an algorithm into a single executable object that can be called or invoked whenever we need to perform the task that the algorithm does. Parameters enable us to make our procedures more general (and hence more abstract). It should be easy with the Logo to see that the forward procedure is too specific because it moves the Android only 10 steps and that the forward(N) procedure is more general and hence more useful.
Other Resources:
- Logo 1 Lesson Handout - Created by Joseph Kess, Wethersfield High School
- AP pseudocode compared to App Inventor Blocks created by Timothy Clark, Gilroy Unified School District (landscape mode).
4.4.2. Professional Development Reflection¶
Discuss the following questions with other teachers in your professional development program.
-
I am confident I can teach this lesson to my students.
- 1. Strongly Agree
- 2. Agree
- 3. Neutral
- 4. Disagree
- 5. Strongly Disagree
Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.