3.9. Map Tour with TinyDB

This lesson introduces the concept of persistent storage in apps by storing the destinations lists in the Map Tour app in a database called TinyDB, so that it is remembered from the last run of the app. It reinforces the enduring understanding that there are trade-offs in representing digital data, in this case, the differences between storing data in memory (variables) versus persistently (TinyDB).

Professional Development

The Student Lesson: Complete the activities for Mobile CSP Unit 3 Lesson 3.9: Map Tour with TinyDB .

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. 
  • Map Tour with TinyDB Tutorial (video or handout)

3.9.1. Learning Activities

Estimated Length: 45 minutes

  • Hook/Motivation (5 minutes): Ask students how does Amazon know your name when you go to amazon.com? How does it remember all your previous orders? Where is this information stored? See if they have heard of a database. Remind students of the use of variables and properties in the Map Tour app. Ask them what the value of the variable is each time the app is re-started or the properties of the UI components. Explanation: Each time the app is started, the variables and properties are set to their initial values the programmer set up in the app. Right now, it does not remember information from the last time the app was used. In this lesson, we will learn how to make data persist, or last, when an app is closed and restarted.
  • Experiences and Exploration (30 minutes):
    • Presentation (5 minutes): Give students an overview of the TinyDb component using the video or slides.
    • Tutorial Walkthrough (15 minutes): Lead students through incorporating the TinyDb component into the MapTour app so that it will save the list of destinations for the next time the app is used. Make sure that they stop after adding a location and try restarting their app and they will notice that the saved location is gone. This is motivation for adding persistent database storage.
    • Extensions (15 minutes): Working in pairs, students should attempt the extensions. For advanced students who want to explore the special Any Component blocks, see the enrichment section below.
  • Rethink, Reflect, and Revise (5 minutes): Review the concept of persistent data and the TinyDB component. How did it and the creative projects enhance the usability of the app by storing data? Students should complete the interactive exercises and portfolio reflection questions.

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.2 Data Abstraction
  • Topic 3.10 Lists

3.9.2. Professional Development Reflection

Discuss the following questions with other teachers in your professional development program.

  • How does this lesson address the learning objective of extracting information from data using a program?
    [LO DAT-2.D]
    I am confident I can teach this lesson to my students.
  • 1. Strongly Agree
  • 2. Agree
  • 3. Neutral
  • 4. Disagree
  • 5. Strongly Disagree