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).

CSP Framework
Big Idea 2: Data (DAT)
Enduring Understanding DAT-2: Programs can be used to process data, which allows users to discover information and create new knowledge.
Learning Objective DAT-2.D: Extract information from data using a program.
Big Idea 3: Algorithms and Programming (AAP)
Enduring Understanding AAP-1: To find specific solutions to generalizable problems, programmers represent and organize data in multiple ways.
Learning Objective AAP-1.C: Represent a list or string using a variable.
Learning Objective AAP-1.D.a: For data abstraction: a. Develop data abstraction using lists to store multiple elements.
Learning Objective AAP-1.D.b: For data abstraction: b. Explain how the use of data abstraction manages complexity in program code.

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.

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