0
0
Android Kotlinmobile~10 mins

Clean Architecture layers in Android Kotlin - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the layer responsible for business rules in Clean Architecture.

Android Kotlin
class [1] {
  fun execute() {
    // Business logic here
  }
}
Drag options to blanks, or click blank then click option'
AUILayer
BDataLayer
CDomainLayer
DPresentationLayer
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing DomainLayer with DataLayer or PresentationLayer.
2fill in blank
medium

Complete the code to declare the layer that handles UI and user interaction.

Android Kotlin
class [1] {
  fun show() {
    // Display UI
  }
}
Drag options to blanks, or click blank then click option'
ADomainLayer
BPresentationLayer
CDataLayer
DBusinessLayer
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing PresentationLayer with DomainLayer or DataLayer.
3fill in blank
hard

Fix the error in the code by selecting the correct layer name for data access.

Android Kotlin
class [1] {
  fun fetchData() {
    // Access database or network
  }
}
Drag options to blanks, or click blank then click option'
ADataLayer
BDomainLayer
CUILayer
DPresentationLayer
Attempts:
3 left
💡 Hint
Common Mistakes
Using DomainLayer or PresentationLayer for data access.
4fill in blank
hard

Fill both blanks to complete the interface and its implementation for the DataLayer.

Android Kotlin
interface [1] {
  fun getData(): String
}

class [2] : [1] {
  override fun getData() = "Data"
}
Drag options to blanks, or click blank then click option'
ARepository
BDataSource
CRepositoryImpl
DDataLayer
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing interface and implementation names.
5fill in blank
hard

Fill all three blanks to complete the use case class calling the repository method.

Android Kotlin
class [1](private val [2]: [3]) {
  fun execute() = [2].getData()
}
Drag options to blanks, or click blank then click option'
AGetUserData
Brepository
CRepository
DDataSource
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong class or variable names.