Concepts in Android & Kotlin

Kotlin Variables: `val` for Constants, `var` for Variables
In Kotlin, val creates a read-only constant you assign once, like a fixed setting. var creates a mutable variable you can change later. Always prefer val unless you explicitly need to reassign a value to prevent accidental state changes.

Kotlin Null Safety: Catch Nulls at Compile Time
Kotlin's type system catches null pointer errors at compile time. Variables are non-nullable by default; you must opt-in to nulls with a ? (e.g., String?). The compiler then forces you to handle the null case. The main footgun is the !! operator.

Kotlin's Control Flow Expressions: `if` and `when`
In Kotlin, if and when are expressions that return a value. This lets you assign their result directly to a variable, replacing Java's ternary operator. The footgun: when used as an expression, you must have an else branch to cover all cases.

Kotlin Functions: Named, Reusable Code Blocks
A function is a named recipe for your code. You give it ingredients (parameters) and it produces a result. They are used everywhere, from calculating values to handling button clicks.

Kotlin Inheritance: Open for Extension, Closed by Default
In Kotlin, classes are final by default. Think of inheritance as an opt-in feature you enable with the open keyword. Use it to create specialized versions of a base class, like a Student from a Person.

Kotlin Data Classes: Automatic Boilerplate for Data Holders
A Kotlin data class automatically generates boilerplate like equals() and toString() for classes that just hold data. Use it for model objects or DTOs where value equality matters. The footgun: its copy() method is shallow, sharing mutable objects.
Kotlin Collections: Think Transformations, Not Loops
Treat collection operations as a pipeline, not a for loop. Each function (map, filter) transforms data and passes it to the next stage, ideal for turning API data into UI models.

Kotlin Extension Functions: Add Methods Without Inheritance
Kotlin extension functions let you add new functionality to existing classes without inheritance, as if you were adding a new method. They're perfect for creating helpers for third-party library classes or framework types like String.

Kotlin Scope Functions: Cleaner Code, Clearer Choices
Kotlin's scope functions (let, run, apply) create a temporary workspace for an object, avoiding repetitive variable names. Use them for object configuration or chaining calls.

Kotlin Sealed Classes: Enums for Types
A sealed class is like an enum, but for types. It defines a closed set of subclasses, letting each one carry different data. It's perfect for modeling states like Loading, Success, and Error, ensuring you handle every case at compile time.

Kotlin Coroutines on Android
Kotlin coroutines let Android code write asynchronous logic that reads like sequential code, suspending instead of blocking a thread. Structured concurrency ties each coroutine to a scope, so a destroyed ViewModel cancels its children automatically.

Coroutine Dispatchers: Telling Your Coroutines Which Thread to Use
A Dispatcher tells a coroutine which thread or thread pool to use for its work. Use Dispatchers.Default for CPU-intensive tasks. If none is specified, it inherits from its parent. The main footgun: Unconfined can resume on an unexpected thread.

CoroutineScope: The Parent of Your Coroutines
A CoroutineScope acts as a parent to a group of coroutines, managing their lifecycles. When the parent scope is cancelled, all its children are cancelled too. It's used with builders like launch to group related work, like in an Android ViewModel.

Kotlin Flow: Asynchronous Data Streams
A Kotlin Flow is like an async Sequence, emitting multiple values over time without blocking. It's used for live data from a database or streaming network responses. The footgun: Flows are cold; the code doesn't run until a collector calls .collect().

Structured Concurrency in Kotlin
Structured concurrency treats async operations like code blocks: a parent task's lifetime contains its children. In Kotlin, a CoroutineScope ensures if the parent is cancelled, all its child coroutines are too.

Kotlin's Job: A Handle to a Background Task
A Job is a handle to a coroutine, letting you manage its lifecycle. You get one from launch to control background tasks like network calls. The key footgun: a child's *failure* (Exception) cancels its parent, but a child's *cancellation* does not.

Kotlin Coroutines: async/await for Parallel Results
async starts a coroutine for a parallel result, returning a Deferred value. await pauses until that result is ready. Use it to run independent network calls concurrently. The footgun: using it for sequential tasks creates a needless race condition.

StateFlow: A Hot Flow for UI State
StateFlow is a state-holder observable that emits the current and new state updates to its collectors. Use it to expose UI state from a ViewModel to a UI. The footgun: slow collectors can miss intermediate state updates, receiving only the most recent value.

Kotlin Delegated Properties: Reusing Getter/Setter Logic
Kotlin's delegated properties let you outsource a property's getter/setter logic. Instead of writing boilerplate, you reuse common patterns like lazy initialization (by lazy) or observing changes (by observable).

Coroutine Exception Handling: launch vs. async
Coroutine builders handle exceptions differently. launch propagates them immediately, crashing if unhandled. async silently catches them, waiting for you to call await. Use a CoroutineExceptionHandler on root scopes for global logging.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles