Skip to main content
David Cruz Anaya

David Cruz Anaya

Senior Android & Kotlin Multiplatform Engineer

  • Home
  • About
  • Portfolio
  • Book
  • Speaking
  • Blog
  • Flashcards
  • Nomad Life
  • Contact
Visit Vectencia Shop

Follow Me

Privacy Policy

2014 - 2026 © davthecoder is trading as Vectencia Ltd.

davthecoder
davthecoder.com
davthecoder × Vectencia
🐛

P0 Bug Hunter

Find the bugs in each code snippet

Hotel Search2 P0s4 total
1/8
1class SearchViewModel(
2 private val api: HotelSearchApi
3) : ViewModel() {
4
5 val uiState = MutableStateFlow(SearchUiState())
6
7 fun search(query: String) {
8 viewModelScope.launch {
9 uiState.value = uiState.value.copy(isLoading = true)
10 try {
11 val response = api.searchHotels(query)
12 val hotels = response.body()!!.results
13 uiState.value = uiState.value.copy(
14 isLoading = false,
15 hotels = hotels
16 )
17 } catch (e: Exception) {
18 uiState.value = uiState.value.copy(
19 isLoading = false,
20 error = "Something went wrong"
21 )
22 }
23 }
24 }
25}
Click on the lines you think have bugsFound 0 of 4
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off
Skip to main content
David Cruz Anaya

David Cruz Anaya

Senior Android & Kotlin Multiplatform Engineer

  • Home
  • About
  • Portfolio
  • Book
  • Speaking
  • Blog
  • Flashcards
  • Nomad Life
  • Contact
Visit Vectencia Shop

Follow Me

Privacy Policy

2014 - 2026 © davthecoder is trading as Vectencia Ltd.

davthecoder
davthecoder.com
davthecoder × Vectencia
🐛

P0 Bug Hunter

Find the bugs in each code snippet

Hotel Search2 P0s4 total
1/8
1class SearchViewModel(
2 private val api: HotelSearchApi
3) : ViewModel() {
4
5 val uiState = MutableStateFlow(SearchUiState())
6
7 fun search(query: String) {
8 viewModelScope.launch {
9 uiState.value = uiState.value.copy(isLoading = true)
10 try {
11 val response = api.searchHotels(query)
12 val hotels = response.body()!!.results
13 uiState.value = uiState.value.copy(
14 isLoading = false,
15 hotels = hotels
16 )
17 } catch (e: Exception) {
18 uiState.value = uiState.value.copy(
19 isLoading = false,
20 error = "Something went wrong"
21 )
22 }
23 }
24 }
25}
Click on the lines you think have bugsFound 0 of 4
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off