🗄️
Room for Error
Find the bugs in each code snippet
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off
Find the bugs in each code snippet
1@Dao2interface BookingDao {3 @Query("SELECT * FROM bookings ORDER BY check_in DESC")4 fun getAll(): List<Booking>56 @Query("SELECT * FROM bookings WHERE id = :id")7 fun getById(id: String): Booking?89 @Insert(onConflict = OnConflictStrategy.REPLACE)10 fun insertAll(bookings: List<Booking>)1112 @Delete13 fun delete(booking: Booking)14}1516class BookingHistoryViewModel(17 private val dao: BookingDao18) : ViewModel() {1920 val bookings = MutableStateFlow<List<Booking>>(emptyList())2122 init {23 bookings.value = dao.getAll()24 }2526 fun removeBooking(booking: Booking) {27 dao.delete(booking)28 bookings.value = dao.getAll()29 }30}Find the bugs in each code snippet
1@Dao2interface BookingDao {3 @Query("SELECT * FROM bookings ORDER BY check_in DESC")4 fun getAll(): List<Booking>56 @Query("SELECT * FROM bookings WHERE id = :id")7 fun getById(id: String): Booking?89 @Insert(onConflict = OnConflictStrategy.REPLACE)10 fun insertAll(bookings: List<Booking>)1112 @Delete13 fun delete(booking: Booking)14}1516class BookingHistoryViewModel(17 private val dao: BookingDao18) : ViewModel() {1920 val bookings = MutableStateFlow<List<Booking>>(emptyList())2122 init {23 bookings.value = dao.getAll()24 }2526 fun removeBooking(booking: Booking) {27 dao.delete(booking)28 bookings.value = dao.getAll()29 }30}