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
💣

Compose Landmines

Find the bugs in each code snippet

Hotel List Item0 P0s3 total
1/10
1@Composable
2fun HotelListScreen(viewModel: HotelListViewModel) {
3 val hotels by viewModel.hotels.collectAsState()
4
5 LazyColumn {
6 items(hotels) { hotel ->
7 HotelCard(
8 hotel = hotel,
9 amenities = hotel.amenities.toList(),
10 onFavorite = { viewModel.toggleFavorite(hotel.id) },
11 onClick = { viewModel.navigate(hotel.id) }
12 )
13 }
14 }
15}
16
17@Composable
18fun HotelCard(
19 hotel: Hotel,
20 amenities: List<String>,
21 onFavorite: () -> Unit,
22 onClick: () -> Unit
23) {
24 Card(onClick = onClick) {
25 Text(hotel.name)
26 Text("${hotel.price}/night")
27 Row {
28 amenities.forEach { Text(it) }
29 }
30 IconButton(onClick = onFavorite) {
31 Icon(Icons.Default.Favorite, null)
32 }
33 }
34}
Click on the lines you think have bugsFound 0 of 3
←→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
💣

Compose Landmines

Find the bugs in each code snippet

Hotel List Item0 P0s3 total
1/10
1@Composable
2fun HotelListScreen(viewModel: HotelListViewModel) {
3 val hotels by viewModel.hotels.collectAsState()
4
5 LazyColumn {
6 items(hotels) { hotel ->
7 HotelCard(
8 hotel = hotel,
9 amenities = hotel.amenities.toList(),
10 onFavorite = { viewModel.toggleFavorite(hotel.id) },
11 onClick = { viewModel.navigate(hotel.id) }
12 )
13 }
14 }
15}
16
17@Composable
18fun HotelCard(
19 hotel: Hotel,
20 amenities: List<String>,
21 onFavorite: () -> Unit,
22 onClick: () -> Unit
23) {
24 Card(onClick = onClick) {
25 Text(hotel.name)
26 Text("${hotel.price}/night")
27 Row {
28 amenities.forEach { Text(it) }
29 }
30 IconButton(onClick = onFavorite) {
31 Icon(Icons.Default.Favorite, null)
32 }
33 }
34}
Click on the lines you think have bugsFound 0 of 3
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off