Unit 4 QuizziesΒΆ

Unit 4 Pathway 1 QuizziesΒΆ

  1. Using an app on your phone, explain which app data belongs in the Data Layer, which belongs in a state holder, and which could belong to either.

    example

    Spotify:

    • Data Layer: song metadata, user preferences, app version.

    • State Holder: currently-playing song, playback status (playing/paused/stopped).

Unit 4 Pathway 2 QuizziesΒΆ

  1. What are the similarities and differences between routing in Android vs routing in Flask or Spring Boot?

    #solulu
    • Similarities

      • They use strings to define routes/endpoints

      • They use routing mechanisms to define and manage routes: Android uses NavHostController, Flask uses @app.route(), Spring Boot uses @RequestMapping

      • In Android, a route is a string that identifies a destination (a screen), similar to how Flask and Spring Boot use URLs to map requests to specific views or controllers. Both systems use predefined routes to navigate between different views or endpoints.

      • Data can be passed: using arguments for Android, and query strings for Flask and Spring Boot.

    • Differences

      • Android navigation largely requires a user to interaction with the screen, to trigger an event from the user interface which causes a screen change. Flask and Spring Boot trigger screen changes when an HTTP request is received. This HTTP request can be sent due to a user interacting with a screen, or it can be sent using automated tools like curl, Postman, etc.

      • Android uses NavHost and NavGraph to display certain composables based on the current route. Flask and Spring Boot may serve completely different web pages.

      • Android uses stateholders like ViewModel to maintain UI state. Flask and Spring Boot use cookies, databases, or sessions to maintain state.

      • Android tracks track visited screens and maintains the back stack. Flask and Spring Boot don’t; they rely on the client (browser) to handle back navigation.

Unit 4 Pathway 3 QuizziesΒΆ

  1. What are the strengths and weaknesses of using a NavHostController vs handling screen changes using a state-based approach?

    #solulu
    • Strengths:

      • Reduces dependency on NavHostController

      • More efficient for small applications with minimal navigation and just 1-2 screens.

    • Weaknesses:

      • Requires manual back navigation handling.

      • More complex for larger applications with multiple screens and complex navigation flows.

  2. The Reply app decides whether to use list-detail view based solely on the window size. What are some other factors that might influence an app’s decision to use list-detail view? If possible, use a specific app on your phone to illustrate.

    #solulu
    • User preferences: whether the user prefers list-detail view or not

    • Task context: whether it suits the task or not

    • Accessibility settings: if text is too large, list-detail view may not be suitable

    • Device capabilities: some foldable devices may be suitable for list-detail view