CodeBlanks Logo Icon CodeBlanks

Project design

Design the skeleton of the expert final mini app.

Project design

In this five-lesson expert final you will build the Expert Notes mini app. Each lesson adds one piece; in the final lesson KMP, KSP and Compose merge.

The first lesson sets up the skeleton: object App and fun run(): String. This object is the root of the whole app; in later lessons you will add shared data, code generation and UI around it. main just calls App.run() and prints the result.

The App object skeleton

The first lesson defines an object named App. In Kotlin object declares a singleton; you access it directly through its name.

Example skeleton: object App { fun run(): String = "Expert Notes" }. This object is called as App.run(). Methods inside an object need no instance; they are called directly through the object name. In later lessons shared data, code generation and UI will be added around this object.

Practice Define the App object

Define object App. Add fun run(): String = "Expert Notes". In main, write println(App.run()).

Starter code

Main.kt
// Define the App object
// run method returns "Expert Notes"

fun main() {
    // call the run method and print the result
}

Sample solution

Main.kt
object App {
    fun run(): String = "Expert Notes"
}

fun main() {
    println(App.run())
}

Expected output

Expert Notes

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does the first lesson set up?

Main.kt
The first lesson defines the root object.
  • App skeleton Correct answer
  • Compose UI
  • KSP processor
  • iOS framework

Explanation: The first lesson sets up the App object skeleton.

2 Complete the App definition

Question
object App { fun ____(): String { return "Expert Notes" } }
Answer
object App { fun run(): String { return "Expert Notes" } }

Explanation: object App { fun run() } declares the singleton root.

3 Match the App skeleton parts

Term Meaning
object App Singleton root
fun run Starter
Expert Notes App name
main Entry point

All lessons in Expert