Unit 3 QuizziesΒΆ
Choose an app on your phone. Explain how it might use any one of these features:
Singleton objects
Interfaces
Generics
Extension properties
Extension functions
LazyColumn
example
Grab offers various types of rides like GrabCar, GrabTaxi, etc. An interface might be used to define the common functionality of different types of rides. The interface could contain methods like
calculateFare(),getDriverLocation(), etc. Each type of ride can implement this interface in its own way.#solulu
Singleton objects: a media player could use a singleton object thatβs responsible for playing audio. This ensures that only one song/video is playing at a time.
Interfaces: an interface for an in-app game could include common functions that need to be implemented, like
setGameScore(), etc. Example: https://github.com/elbekD/kt-telegram-bot/blob/4a749ffc7f10b2e0a5d3a313c7f7df904ba14892/library/src/main/kotlin/com/elbekd/bot/api/TelegramGameApi.ktGenerics: Instagram can show both videos and images, it could use a generic List<T> to work with both types
Extension properties: a weather app could use an extension property to convert temperature from Celsius to Fahrenheit
Extension functions: a messaging app could use an extension function to format a message before sending it
LazyColumn: anything that scrolls, like Instagram, TikTok, reddit could all use a LazyColumn to display items only on demand
LazyColumn tries to optimize performance by loading items on-demand. What are other similar methods that apps on your phone use to achieve the same effect?
#solulu
Pagination: loads items one page at a time
Infinite scroll: loads items as the user scrolls
Map loading: show the details like roads, buildings, etc. only when the user zooms in
Image galleries: load a low-resolution thumbnail first, then load the full-resolution image when the user taps on it
Chat history: load old messages from a year ago only if user taps on that specific date
What is one specific example of an ick you have with a animations in a mobile app, and how would you improve it?
#solulu
Progress bars that are stuck at 90+% feel scammy. Either compute the progress more accurately, or show a different animation that doesnβt imply completion.