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.

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

  • 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:

AP Classroom

The College Board's AP Classroom provides a question bank and Topic Questions. You may create a formative assessment quiz in AP Classroom, assign the quiz (a set of questions), and then review the results in class to identify and address any student misunderstandings.The following are suggested topic questions that you could assign once students have completed this lesson.

Suggested Topic Questions:

  • Topic 3.8 Iteration
  • Topic 3.14 Libraries

Assessment Opportunities and Solutions

Solutions Note: Solutions are only available to verified educators who have joined the Teaching Mobile CSP Google group/forum in Unit 1.

Assessment Opportunities

You can examine students’ work on the interactive exercise and their reflection portfolio entries to assess their progress on the following learning objectives. If students are able to do what is listed there, they are ready to move on to the next lesson.

  • Interactive Exercises:
  • Portfolio Reflections:
    LO X.X.X - Students should be able to ...
  • In the XXX App, look for:

Differentiation: More Practice

If students are struggling with lesson concepts, have them review the following resources:

  • Encourage them to test incrementally — adding only one feature to the face before they test their code
  • Ensure they are using procedures for different parts of the face (each eye, the mouth, moving the turtle between steps, etc.). An example of the procedures they write could be:
    1. drawFace
    2. moveToRightEye
    3. drawRightEye
    4. moveToLeftEye
    5. drawLeftEye
    6. moveToMouth
    7. drawMouth

Differentiation: Enrichment

Students can add enhancements to their face, such as ears or eyeglasses. Students could also explore the use of for each loops to improve their code.

Background Knowledge: Algorithms & Logo

  • Algorithms vs Recipes: Algorithms vs. Recipes: It's important to be a little careful with this distinction. Recipes are certainly like algorithms but many recipes would not count as algorithms (in computer science) because their statements are not precise enough. So it is preferable to say that an algorithm is like a recipe rather an algorithm is a recipe. We can revisit this distinction later on in the course when we talk about analyzing algorithms. This is not to say that teachers should avoid using recipes to teach students about algorithms. There are lots of good lessons and exercises that use this approach. For example, one that seems to work well is to have students describe a recipe for making a PB&J sandwich and then try to implement it (make PB&Js to eat) and then discuss the ways in which their recipes failed to work -- mostly because steps were left out or steps were not precise enough. This might be a good way of saying that for a recipe to be considered an algorithm, it would have to be so precise and each step so simple that it could be carried out by a machine.
  • More on Logo and Turtles: Logo, Papert and Constructionist Learning

Teaching Tips: Incremental Testing

Emphasize that as programs become more complex, it is better to add features one at a time to a program then test, instead of adding all the features and testing at the end. Procedures can help manage the complexity of the program by encapsulating steps that work in a procedure and reducing the number of blocks in the main draw procedure.

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