Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 228

Compare and contrast `apply` and `let` scope functions
Android & Kotlin2 min read

Compare and contrast `apply` and `let` scope functions

Tests Kotlin scope function knowledge: context (this/it) & return value. apply uses this, returns the object (for config). let uses it, returns lambda result (for null-checks/transforms). Red flag: mixing up return values or use cases.

When to use a sealed class instead of an enum?
Android & Kotlin2 min read

When to use a sealed class instead of an enum?

Tests your grasp of Kotlin's type hierarchies. Use sealed class for states with associated data (e.g., Success(data)), as subclasses can have unique properties. Use enum for simple, constant states. A red flag is treating them as interchangeable.

Explain and implement a Kotlin higher-order function
Android & Kotlin2 min read

Explain and implement a Kotlin higher-order function

Tests understanding of first-class functions and lambda usage. First, define a higher-order function (HOF) as one that takes/returns functions. Then, implement the requested function, iterating to apply the predicate and transform.

lateinit var vs. val by lazy in Android
Android & Kotlin2 min read

lateinit var vs. val by lazy in Android

Tests your grasp of Kotlin property initialization and its lifecycle implications. A good answer contrasts mutability (var/val), initialization timing, and thread safety.

What are the advantages of a Kotlin data class and its functions?
Android & Kotlin2 min read

What are the advantages of a Kotlin data class and its functions?

Tests knowledge of Kotlin's idiomatic features. A good answer explains the main advantage (boilerplate reduction), lists generated functions like toString() and equals(), and describes copy() for immutable state updates.

What is a Kotlin extension function? Write one for String.
Android & Kotlin2 min read

What is a Kotlin extension function? Write one for String.

Tests adding functionality to classes without inheritance. Define extension functions as static utilities, explain their use case (e.g., third-party libs), then write hasWhitespace using an idiomatic method like any. A red flag is manually looping.

Purpose of safe call (`?.`) and Elvis (`?:`) operators
Android & Kotlin2 min read

Purpose of safe call (`?.`) and Elvis (`?:`) operators

This tests your grasp of Kotlin's idiomatic null safety. Explain the safe call (?.) for chaining on nullables and the Elvis operator (?:) for providing defaults. Combine them in a one-line example. A multi-line if/else is a red flag.

Explain val, var, and null safety in Kotlin
Android & Kotlin2 min read

Explain val, var, and null safety in Kotlin

This tests your grasp of immutability and Kotlin's compile-time null safety. Define val (immutable reference) vs. var (mutable), explain nullable types using ?, and state the risk is NullPointerException. A red flag is confusing val with a constant.

Android & Kotlin2 min read

Constraints: Building UIs with Relationships, Not Boxes

Constraints define UI by relationships, not nested boxes. Think of it like telling elements 'align with that one' instead of placing them in rigid rows. This is key for complex, responsive layouts, but can lead to unsolvable rules if not defined carefully.

Android & Kotlin2 min read

WorkRequest: The Blueprint for Android Background Tasks

A WorkRequest is the blueprint for a background task in Android. It defines *what* work to do and *when*, letting WorkManager handle execution for tasks like syncing data. The footgun is putting logic in the request; it only configures, the Worker acts.

Android & Kotlin2 min read

OkHttp Interceptors: Middleware for Your Network Stack

OkHttp Interceptors act as middleware for your network stack, letting you observe, modify, or short-circuit requests and responses. Use them to automatically add auth tokens or log traffic. The main footgun is order: application interceptors run once per call.

Android & Kotlin2 min read

Gradle Build Scripts: The Recipe for Your App

Gradle build scripts are your app's recipe, using a declarative DSL to define dependencies and build variants. They manage libraries and create versions like debug vs. release.

Android & Kotlin2 min read

Deobfuscating Android Crash Stack Traces

Obfuscated crash reports are useless. Deobfuscation uses a mapping file from your build to translate stack traces back into readable code. This is vital for debugging production apps using R8/ProGuard or native C++.

ContentProvider: Android's Shared Data API
Android & Kotlin1 min read

ContentProvider: Android's Shared Data API

A ContentProvider is a structured API gateway for your app's private data. It lets other apps query, insert, or delete data securely without direct access. The main footgun is improper permission handling, which can leak data or cause crashes.

Kotlin's Job: A Handle to a Background Task
Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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's Control Flow Expressions: `if` and `when`
Android & Kotlin2 min read

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.

Analytics & Metrics2 min read

Design a Privacy-Compliant Analytics Architecture

This tests your ability to balance data utility with strict privacy controls. A great answer outlines a central governance layer, dynamic masking, and purpose-based access tied to auditable logs.

Analytics & Metrics2 min read

A key metric dropped 15%. How do you investigate?

This tests systematic debugging of business metrics. A great answer first validates the data itself, then checks for recent changes (deploys, features), and finally segments the drop to isolate the cause. A red flag is immediately assuming a product bug.

Analytics & Metrics2 min read

SARIMA vs. LightGBM for Forecasting with External Variables

Tests your grasp of practical trade-offs in model selection. A strong answer contrasts SARIMA's interpretability with LightGBM's power for handling many non-linear variables, covering performance and implementation costs.