Gotchas
Every gotcha from every post, grouped by theme. Use it as a checklist the night before an interview: read each line, and if you cannot say in one sentence why it is a mistake and what to do instead, follow the link.
Each entry links to the “The Gotchas” section of the post that explains it in full.
Opening and Scoping the Problem
From the first five minutes:
- Ritual questions. Asking because the book said to, with no visible effect on the design. Every question should change something.
- Too many questions. Ten minutes of clarification is its own failure. Cap at five or six, then state defaults.
- Not cutting anything. Choose the core flow and say what you are deferring.
- Never naming the hard part. Without it, the deep dive has no target.
- Estimating everything, or nothing. Three numbers and a “so.”
- No agreement on the plan. Ten seconds prevents a minute-twenty redirect.
- Dead air. Narrate your thinking.
- Mishandling “assume whatever you want.” It is an invitation to state defaults, not skip the step.
- Not writing it down. Requirements go top-left and stay there.
- Treating the interviewer as an examiner. They are a colleague for forty-five minutes.
From back-of-envelope numbers:
- False precision. A day is 100,000 seconds. A million a day is ten a second.
- Forgetting the peak. Average is what you compute; peak is what you design for.
- Forgetting replication and indexes. Raw 1 TB is 4 TB provisioned.
- Mixing bits and bytes. A 10 gigabit link moves about 1.25 gigabytes per second.
- Estimating things that do not matter. Estimate the dimension that drives a decision.
- Not saying the assumption. An assumption can be corrected; a bare number cannot.
- Stopping at the number. Always finish with “so.”
And from the design posts:
- Skipping capacity estimation. Without numbers you cannot justify anything. (URL shortener)
- Answering in the first ten seconds. The question is a prompt to ask clarifying questions. (Monolith or microservices)
- Designing for the average. Three per second on average, a hundred thousand in the first minute of an on-sale. (Ticket booking)
Consistency and Isolation
From what consistency actually means:
- Three different words spelled the same way. ACID consistency, CAP consistency, and consistency models are different things. Say which.
- Strong versus eventual as a binary. The session guarantees in between are what users notice.
- Choosing eventual without naming the anomaly. “Eventual” means “the user may see X, and here is why that is fine.”
- Assuming a primary with replicas is strongly consistent. Replica reads lag.
- Assuming the cache agrees with the database. Cache-aside has a window and a race.
- Confusing consistency with durability or atomicity. Different axes.
- “Kafka guarantees ordering.” Per partition only.
- Claiming linearizability across two systems. Database plus search index is never linearizable.
- Ignoring the cost. Cross-region linearizable writes have a 100 ms floor.
- Mixing up the two axes. Replication models are single-object visibility across replicas; isolation is multi-object transactions on one copy.
From transaction isolation levels:
- Assuming ACID means serializable. The I is configurable and the default almost never is.
- Assuming read committed prevents lost updates. It does not.
- Assuming “repeatable read” means the same thing everywhere. Standard, PostgreSQL, and MySQL are three different things.
- Not knowing write skew. Snapshot isolation’s one hole, and why serializable exists.
- Read-modify-write in application code. The most common production concurrency bug.
- Turning on serializable and not writing retries. Optimistic implementations abort; the application must retry.
- Checking uniqueness in code. A unique constraint is the only correct answer.
- Long transactions. Never span user think time or an external call.
- Assuming isolation spans services. It does not. That is sagas and the outbox.
- Conflating the two axes. “Two increments produced one” is isolation. “My comment vanished on refresh” is replication.
From ticket booking:
- The seat map as the source of truth. It is a display. The hold attempt decides.
- “Best available” as a serializable transaction. Pick candidates from the cache, attempt a conditional multi-row update, retry with the next candidates.
- General admission as read-modify-write. One conditional decrement.
Idempotency, Retries, and Exactly-Once
From idempotency keys, properly:
- Claiming natural idempotency that is not there. “Set status to paid” is idempotent. “Send the confirmation email” is not.
- Letting the server generate the key. A server-minted key cannot survive a lost response.
- Getting the scope wrong. Scope to caller and operation.
- Check-then-act. Reserve the key with an atomic insert first. That insert is the lock.
- Storing the key somewhere other than the side effect. Same transaction, or propagate the key downstream.
- Not storing the response. A replay must return the same status and body.
- Same key, different payload. Fingerprint the request and reject mismatches.
- Caching failures forever. A downstream timeout should be retryable under the same key; a validation error should not.
- Forgetting the second line of defense. A natural unique constraint catches what expired keys miss.
- Idempotent is not the same as ordered. Out-of-order updates are a versioning problem.
And from the design posts:
- Promising exactly-once. The scheduler cannot distinguish “ran and crashed” from “never ran.” At-least-once plus idempotent jobs. (Job scheduler)
- Check-then-increment. Two requests read 99, both pass, both write 100. The counter operation must be atomic on the store. (Rate limiter)
- Non-idempotent steps. The relay delivers at least once; every consumer needs an inbox. (Sagas and the outbox)
- Charging twice. A retry without an idempotency key on the charge is a second charge. (Ticket booking)
- The payment provider says nothing. Query by your idempotency key before deciding to retry or give up. (Ticket booking)
Coordination, Leases, and Hot Rows
From the job scheduler:
- One scheduler, or several with no coordination. Leader election, partition ownership, or an atomic claim. Name the one you are using.
- Polling without a plan. Index the due time and claim a batch atomically with
SKIP LOCKED, or use a sorted structure. - Leases that expire while the job is still running. Heartbeats extend the lease; a fencing token rejects a stale worker’s writes.
- Everything at midnight. Estimate the peak, not the average. Jitter what does not need the exact minute.
- Time zones and daylight saving. Store the zone, compute next run in it, store the result in UTC.
From ticket booking:
- Locking the seat during payment. The lock is held for the provider’s latency. The hold is a status and an expiry, not a lock.
- Holds that expire by cron. Dead inventory between expiry and the job, and a race with purchase. Expiry lives inside the conditional update.
- No waiting room. An unbounded burst, random fairness, and bots win.
- Pretending the hot event is not hot. The event is the unit of contention. Say how one shard survives it.
And from the other design posts:
- A hot tenant on one shard. Split the tenant’s counter into sub-keys. (Rate limiter)
- Hashing the URL and truncating. Collisions become likely long before the keyspace fills, and the check-and-retry is a race. (URL shortener)
- Using the database’s auto-increment ID. Predictable, enumerable, and a single write sequence. (URL shortener)
Cross-Service Transactions
From sagas and the outbox:
- The dual write. Save then publish, or publish then save. Either order loses something on a crash.
- Saying “two-phase commit” as if it were available. Brokers, APIs, and managed services do not participate; the coordinator is a single point of failure.
- Compensation as rollback. A refund is a new transaction that can fail.
- Choreography spaghetti. Fine for two or three steps; past that it needs an owner.
- The orchestrator as a god service. Keep it to sequencing and state.
- Forgetting that intermediate states are visible. Sagas have no isolation. Use a pending status as a semantic lock.
- Designing only the happy path. Every compensation needs a “what if this fails.”
- Losing ordering in the relay. Partition by aggregate ID.
And from the monolith post:
- Forgetting the data. Splitting the code is easy. A service that shares a database is not a separate service. (Monolith or microservices)
Failure Handling and Degradation
- No answer for when the counter store is unavailable. Fail open for public API limits; fail closed for limits that protect a fragile downstream. Per rule, not global. (Rate limiter)
- Making the limiter a synchronous hop to another region. Keep limits per region or accept approximate global limits. (Rate limiter)
- No misfire policy. Scheduler down twenty minutes; skip, fire once, or fire all is per-job configuration. (Job scheduler)
- No history. “Why did my job not run at 09:00?” is the first support ticket. (Job scheduler)
Read Paths, Caching, and the Client Contract
- Designing for writes when the workload is reads. A shortener sees 10 to 100 reads per write; the read path is the design. (URL shortener)
- Ignoring the 301 vs. 302 decision. A 301 caches at the browser and kills analytics. (URL shortener)
- Forgetting the unglamorous requirements. Expiration, deletion, custom aliases, rate limiting, abuse. (URL shortener)
- Answering “should the same long URL always return the same short code?” without asking who is asking. A product question disguised as a technical one. (URL shortener)
- Naming an algorithm without saying what it optimizes for. Every rate limiting algorithm trades bursts, memory, and boundary accuracy. (Rate limiter)
- Keying on IP address by default. Punishes everyone behind a NAT; barely inconveniences a botnet. (Rate limiter)
- Forgetting the response contract. 429, Retry-After, RateLimit headers. (Rate limiter)
- Confusing rate limiting with load shedding. One is a policy about a client; the other is a policy about the server. (Rate limiter)
Boundaries and Proportionality
From monolith or microservices:
- Treating “microservices” as the grown-up option. An experienced interviewer will drill into the costs until you run out.
- Ignoring the modular monolith. The most defensible starting point for most new systems.
- Confusing scaling the code with scaling the team. Microservices scale deployment independence, not throughput.
- Not mentioning Conway’s Law. Boundaries that do not match teams do not hold.
And from the other posts:
- Conflating scheduling, execution, and orchestration. When, what, and dependencies are three concerns. (Job scheduler)
- Using a saga where the boundary is wrong. If every operation needs a saga across A and B, they are one service. (Sagas and the outbox)
Sharding and Partitioning
From how to shard a database:
- Sharding first. Indexes, caches, replicas, a bigger machine, and moving write-heavy data out come before a one-way door.
- Choosing the key by cardinality alone. An even spread is useless if the main query does not carry the key.
- Sharding by time or by a sequential ID with ranges. All of today’s writes land on the newest shard.
hash(key) % Nover the physical shard count. Changing N moves almost every key; hash into many logical shards instead.- Forgetting the queries that do not have the key. Each needs a global index, a read model, or an accepted scatter-gather.
- Assuming joins, transactions, and unique constraints still work. Only within a shard; name what replaces each.
- Forgetting the whale. A hash spreads keys, not load; one huge tenant or celebrity still lives on one shard.
- Auto-increment IDs per shard. They collide; use Snowflake-style IDs, UUIDs, or central ranges.
- No resharding plan. Say how a logical shard moves before you need to move one.
- Forgetting that each shard is a full database. Replicas, backups, and migrations multiply by the shard count.
From what sharding takes away:
- Reciting the list without the reason. One engine no longer sees every row; lead with the mechanism and the list follows.
- Sharding related tables by their own primary keys. A user’s orders scatter across every shard; shard orders by
user_idand the join is local. - Assuming per-shard transactions add up to a global one. Two atomic commits are not one; the failure between them is where money disappears.
- Assuming a unique constraint still holds. Only if it includes the shard key; otherwise give the value its own table sharded by it.
- Reaching for two-phase commit by default. Co-locate first, saga second, two-phase commit last.
- Joining in application code one row at a time. N+1 across a network; batch into one multi-get per shard.
- Per-shard auto-increment, or the offset trick. Counters collide, and odd/even offsets freeze the shard count.
- Forgetting that reads across shards are not a snapshot. A report can see the debit without the credit.
- Treating distributed SQL as free. It hides the mechanism, not the latency.
System Shapes
From read-heavy lookup:
- Adding a cache without the hit-rate arithmetic. Database load is the miss rate times the read rate; at 40,000 reads per second, 99% versus 90% is one database versus five.
- Assuming the cache never fails. A cache absorbing 99% of reads means a restart sends 100% to a database sized for 1%; plan load shedding and gradual warm-up.
- Treating cache-aside as correct. A slow reader can write the old value back after the writer’s delete; a TTL bounds the race, a version check or lease closes it.
- The cache stampede. A hot key expires and thousands of simultaneous misses rebuild it; use request coalescing, early refresh, and jittered TTLs.
- Forgetting negative lookups. Requests for nonexistent keys always miss and always hit the database; cache “not found” briefly.
- Ignoring the person who just wrote. Staleness is invisible to everyone except the author who refreshes; they need read-your-writes.
- One TTL for the whole record. Description, price, and stock change at different rates; split the record and cache each part on its own terms.
- Making the decision from the cache. Show the cached price on the page; checkout reads price and stock from the source of truth.
- Putting analytics on the read path. A counter increment per redirect turns a read-heavy system write-heavy; emit an event and aggregate elsewhere.
- Caching per-viewer results. Per-viewer renderings blow up the cache and leak private fields on a key mistake; cache the raw record and apply visibility after the read.
From write-heavy ingest:
- Writing each event synchronously to the database. A million single-row inserts a second is a million round trips; batch at every hop and put a log in front of the store.
- Treating the queue as infinite. Kafka absorbs bursts only up to its retention; say whether you block, drop, or sample when it fills, and for which data.
- Choosing the partition key without thinking. Keying by source melts one partition for a noisy source; random keys lose the ordering and locality sessionization and compression need.
- Ignoring cardinality in metrics. One unbounded label such as user_id turns one series into a million; the samples are cheap but the series index is not.
- Averaging averages when downsampling. Rollups store sum, count, min, max, and a mergeable histogram; means of means and averaged percentiles are wrong.
- Indexing every word of every log line. A full-text index can cost as much as the raw logs; index the structured fields and scan the message.
- Designing logging for the average day. Log volume spikes 10x during incidents, exactly when you need the logs.
- Using processing time for clickstream. Clients batch and go offline; window by event time with a watermark and a lateness policy.
- Assuming exactly-once delivery. Every hop retries; metrics are idempotent, logs tolerate duplicates, billed clicks need dedup by client event ID.
- Forgetting deletion in an append-only system. Time partitions make retention easy, but a privacy deletion is scattered across immutable files; plan for it up front.
From fan-out:
- Choosing push or pull without the follower distribution. Push suits the median user and breaks on the celebrity, pull is the reverse; let the distribution pick a hybrid with a threshold.
- Precomputing for people who will never read it. Fan out only to recently active users; rebuild a dormant user’s feed on demand when they return.
- Copying content into every inbox. Store IDs and hydrate on read; copies multiply storage and make every edit and delete another fan-out.
- Doing the fan-out on the request path. Return once the post is stored; delivery to millions of recipients is asynchronous work behind a queue.
- Forgetting the author. With async fan-out the author refreshes and their post is missing; merge their own recent posts at read time.
- Ordering chat by wall clock. Clocks disagree, so replies render above the message they answer; assign a per-conversation sequence number at one owner.
- One queue for all notifications. A marketing blast in front of a password-reset code is an outage to that user; use separate priority lanes.
- Assuming exactly-once delivery. Queues and mobile clients retry; dedupe with an (event, recipient, channel) key and client-generated message IDs.
- The notification that takes down your own read path. 50 million taps in the same minute is the incident; pace delivery and pre-warm the content.
- One strategy for every group size. Small conversations fan out on write; large channels are read like a feed.
From contended writes:
- Sizing for the average. The design is sized for the peak on one key (on-sale, drop, auction close); the average is noise.
- Read-modify-write in the application. Read the count, subtract in code, write it back is a lost update and the most common oversell bug; make the check and the change one statement.
- Holding a lock across a slow call. A row’s throughput is one over lock hold time; a lock held across a 3-second payment call turns about 1,000 writes per second into about 0.3.
- Optimistic concurrency on a hot key. With 100 clients racing on one row, each round has one winner; compare-and-set degrades quadratically under contention.
- Treating fungible units as distinct, or distinct units as fungible. A stock count can be split into buckets; a seat cannot. Mixing them up wastes throughput or double-sells.
- Holds that never expire, or expire by cron. Check expiry inside the conditional write; use a sweeper only for cleanup.
- Assuming oversell is always forbidden. Airlines overbook and retailers backorder; zero oversell is the most expensive option, so ask the business.
- Using the client’s timestamp to order bids. The order that counts is the commit order at the serialization point.
- Forgetting that the close is a write. An auction ends when one write flips its status to closed, and every bid must include that status in its condition.
- Letting the peak reach the database. Connection pools and the row lock queue give out first; admission control is part of the write path.
From coordination:
- Promising exactly-once. Delivery cannot be exactly-once; the effect can, through at-least-once execution plus an idempotency key at the target.
- Treating a lease as a lock. A paused holder can wake up after its lease was reassigned and keep acting as the owner.
- Trusting wall clocks. Clocks jump and disagree between machines; let one clock decide expiry and use monotonic clocks locally.
- No fencing token at the resource. A token only protects anything if the storage rejects writes carrying a stale one.
- A single Redis key as a correctness lock. Async replication can lose the grant on failover, and Redlock relies on timing assumptions; fine for efficiency, not correctness.
- Putting the coordination store on the data path. Per-task heartbeats into etcd or ZooKeeper make the most fragile component the busiest; keep per-item claims in the database.
- Non-deterministic workflow code. Clock reads, randomness, or direct API calls in workflow code break replay; side effects belong in activities.
- Deploying over running workflows. Reordering steps breaks replay for in-flight workflows; plan versioning from day one.
- Recovery storms. Coordination systems fail quietly and recover loudly; use misfire policies, jittered backoff, and rate-limited reaping.
- Reaching for a lock first. Conditional writes, unique constraints, and single-owner partitions solve most “lock” problems with fewer moving parts.
From real-time:
- Writing every location update to the database. 1 million drivers every 4 seconds is 250,000 writes per second of data overwritten 4 seconds later; keep the latest in memory and sample history asynchronously.
- Polling for real-time. A million clients polling every second is a million mostly empty requests per second with half-interval delay; push over a long-lived connection.
- Forgetting that the connection lives on one server. A message must find the gateway holding the user’s socket; name the connection registry or per-key pub/sub topic.
- The reconnect storm. A dead gateway’s 50,000 clients reconnect in one second and take down the next one; use jittered backoff and incremental resync from a sequence number.
- Expecting the load balancer to spread long-lived connections. Round-robin balances new connections, not existing ones; use least-connections, per-server caps, and graceful drain.
- Ordering by client wall clocks. Phone clocks drift by seconds; order comes from one owner per key assigning sequence numbers, or a logical clock.
- Offering one driver to two riders. Moving a driver from available to offered must be a conditional write with expiry, like a seat hold.
- Last-writer-wins on a shared document. Whole-document overwrites silently lose one editor’s work; use OT or CRDTs so concurrent operations merge.
- Persisting presence and cursors. Cursors change ten times a second and are worthless a second later; broadcast, throttle, and drop them.
- One global index for a local problem. Riders only match nearby drivers; shard matching by city or region and handle boundaries explicitly.
Geospatial Indexing
From geohash vs. quadtree:
- Indexing latitude and longitude separately. Each range returns a strip around the planet; neither composite nor separate B-trees make a spatial index.
- Searching only the cell the user is in. Always the cell plus its neighbors; the closest point may be a few meters over the edge.
- Assuming a shared prefix means close, and close means a shared prefix. Only the first is true; adjacent cells across a boundary can share nothing.
- Returning the cells instead of the answer. Cells are a coarse filter; finish with an exact distance check and a sort.
- Using degrees as distance. A degree of longitude shrinks with latitude; use haversine.
- Ignoring density. One geohash precision is wrong for both Manhattan and Wyoming; the quadtree exists to fix this.
- Putting fast-moving objects in a structure that rebalances. Moving points want a grid where an update is two set operations.
- Treating k-nearest as a radius search. Stop only when the k-th result is closer than the edge of the searched area.
- Building a custom index when the database has one. PostGIS, MongoDB, Elasticsearch, and Redis already ship one.
Coding Screens
From ten coding interview questions in Kotlin:
Array<Int>whereIntArraybelongs. The first boxes every element. Use the primitive arrays.- Mixing Kotlin’s
ArrayDequewith Java’s.addLastandremoveLastversuspushandpop. Pick one API. ==when you meant===.==isequals; for nodes and sentinels, identity matters.- Expecting a smart cast on a mutable property. Copy to a local
val, or use?.and!!deliberately. ..versusuntil.0..nincludesn. Most Kotlin off-by-one bugs are this one.- Negative modulus.
-1 % 5is-1. UseMath.floorModfor buckets and ring buffers. - Forgetting that
PriorityQueueandLinkedHashMapoverrides are Java. Thejava.utilimport, andremoveEldestEntryis Java’s API. Intoverflow in sums, midpoints, and sentinels.lo + (hi - lo) / 2;amount + 1as infinity;Longwhen bounds justify it.sortedBywhen you meantsortBy. One allocates, one sorts in place and mutates the caller’s input.- Recursion where the JVM stack cannot follow. Grid DFS and recursive list reversal overflow. Iterate.
From ten more coding interview questions in Kotlin:
Char.toInt()is deprecated.c.codeon modern Kotlin;c - 'a'works everywhere.- Sorting a string is not one call.
toCharArray().sorted()is aList<Char>; prefer a count-array key. MutableList.removeLast()collides with JDK 21. Can resolve to Java’s method and throw on older runtimes. UseremoveAt(lastIndex).- Adding the live path to the results.
result.add(ArrayList(path)), or every result is the same list. - The shared-row bug in 2D arrays.
Array(n) { IntArray(m) }, never a row captured from outside the lambda. - A local recursive lambda does not compile. Use a local
fun. PairandTriplein hot loops. One allocation and two boxes per element. Read the array directly.var sum = 0infersInt. Kadane, prefix sums, and products overflow silently.0L.- Skewed trees are linked lists. Recursion is O(height) and height can be n. Explicit stack.
- Building strings with
+in a loop. O(n²).StringBuilderorjoinToString.
From ten coding interview questions in Kotlin, part three:
- Bitwise operators are named functions.
and,or,xor,shl,shr,ushr,inv(). There is no^,&, or|on integers. shrversusushron negatives. Arithmetic shift keeps the sign bit; a bit-counting loop withshrnever reaches zero. Useushrorn and (n - 1).- Shift counts wrap and
1 shl 31is negative. Modulo 32 onInt; masks above bit 30 want1L shl n. - Ceiling division that overflows.
(a + b - 1) / boverflows nearInt.MAX_VALUE;(a - 1) / b + 1does not. - One-based DP tables.
Array(m + 1) { IntArray(n + 1) }and index the strings withi - 1. - Kotlin’s
splitis literal; Java’s is a regex. And a trailing delimiter yields an empty final token. binarySearchreturns a negative insertion point. Decode with-(pos + 1).max()changed meaning across versions.maxOrNull()has meant the same thing since 1.4.poll()andpeek()return null on an empty queue. Platform types; checkisNotEmpty()first.- Nested
itshadows silently. Name the parameters the moment you nest lambdas.
From concurrency in Kotlin:
- Cancellation is cooperative, and CPU-bound loops do not cooperate by default. Check
isActive, callensureActive(), oryield(). - Catching
CancellationExceptionand swallowing it.catch (e: Exception)andrunCatchingboth do. Rethrow it, always. GlobalScopeand other unstructured launches. No parent, no waiting, no cancellation. Say what the scope is.asyncexception semantics. In a non-supervisor scope a failingasynccancels the scope immediately, awaited or not.- Blocking on
Dispatchers.Default. One blocked thread is a core gone.withContext(Dispatchers.IO), which also has a cap. - Shared mutable state with no protection.
counter++loses updates;@Volatiledoes not fix it.Mutex, atomics, confinement, or an actor. runBlockingin production code. Formainand tests. Bridge to blocking code at the edge, once.- Accidental serialization.
map { async { }.await() }is sequential. Launch all, thenawaitAll(). - Suspending in
finallyafter cancellation. Throws immediately. Cleanup that suspends runs inwithContext(NonCancellable). - Misplacing
SupervisorJob.launch(SupervisorJob())detaches the coroutine; it does not supervise its children. UsesupervisorScopeor a scope you own.
From “find the bug in this function” (about the debugging exercise itself):
- Rewriting instead of fixing. A rewrite hides whether you found the bug and usually adds a different one.
- Not naming the failing input. Say the input, the wrong output, the right output, then fix.
- Fixing the symptom. A guard that makes the example pass without addressing why the wrong value arose.
- Changing more than needed. A one-line bug gets a one-line fix.
- Not rerunning the original example after the fix. The ticket’s example still has to pass.
- Silent reading. Narrate the hypotheses as you discard them.
- Assuming the bug is where the interviewer pointed. Check the initialization above the loop too.
- Not asking what correct means. Touching intervals is a specification question, not a bug.
- Stopping after the first bug. Say “let me check for another,” and look.
- Not stating the test you would add. The regression test is the other half of the answer.
From JVM runtime questions for Kotlin candidates:
@Volatileon a counter. Visibility and ordering, not atomicity.count++is three operations.- Believing
==on strings is identity.==isequals;===is identity; interning makes===unreliable in both directions. - Not knowing what boxes.
Int?, generics, and avalue classat a generic or nullable boundary are heap objects. - Non-inline lambdas allocate. A function object per call, plus wrapped captures.
inlinepastes the body in. by lazytakes a lock by default.SYNCHRONIZEDunless you chooseNONEorPUBLICATION.objectandcompanion objectinitialize under the class-init lock. Heavy or cyclic initializers stall or deadlock startup.- Nested classes are static by default;
innercaptures the outer. The opposite of Java.innerlisteners on long-lived objects leak. - Compile-time classpath versus runtime classpath.
NoSuchMethodErroris version skew. Pin-Xjdk-releaseand one stdlib version. - Benchmarking without warm-up. The interpreter runs first; the JIT eliminates discarded work. Use JMH.
- Reading a GC pause as “the collector is slow.” Pauses track the live set and allocation rate. Fix the code before the flags.
From functional programming in Kotlin:
valis not immutability.val list = mutableListOf()still mutates;List<T>is a read-only view. Immutability is a property of the whole reachable graph.copy()is shallow. Safe only when every field is itself immutable.- Every chained collection operation allocates a full intermediate list.
asSequence()for large inputs and early exit; eager for small ones. - A
Sequenceis cold and re-runs.count()thentoList()runs the pipeline twice. Materialize once. reducethrows on empty;folddoes not.foldwhen the type changes or the input can be empty.elseon a sealedwhendefeats the point. The compiler checks exhaustiveness only without it.runCatchingcatches everything. Including cancellation andOutOfMemoryError.Resultis for technical boundaries, not domain logic.- Nullable as an error channel.
T?says absent, not why. Use a sealed error type when the reason matters. - Recursion without
tailrecoverflows. Direct self-calls in tail position only; otherwise an explicit stack orDeepRecursiveFunction. - Function types box primitives.
(Int) -> IntisFunction1<Integer, Integer>unless the caller isinline.
Disagreeing and Deciding
From “how do you disagree with a senior engineer?”:
- “I have never really had a disagreement.” Either nothing you worked on mattered, or you are not telling the truth.
- The hero story. “I knew it was wrong, I proved it.” Include the part where they had a point.
- Going around them. Escalating or lobbying before talking to the person is political. The first conversation is with them.
- Disagreeing in the wrong room. Contradicting them in front of their team turns a design question into a status contest.
- Opinion versus opinion. Without a number, a spike, or a document, rank decides.
- Confusing a preference with a risk. Spend pushback on decisions that are hard to reverse.
- Not asking what would change their mind. The question that converts an argument into an experiment.
- Relitigating after the decision. Every later meeting, or the quiet escape hatch. Everyone can see it.
- Caving silently. Concern stated once and dropped, with nothing on record when it happens.
- Making it about seniority. The rank is context. The story is the evidence and the decision.
- Not closing the loop. Without the outcome and the lesson, the story is a complaint.
From “tell me about a time you pushed back on a deadline”:
- The flat no. “It cannot be done” hands the problem back to someone with less information than you.
- The martyr story. “We worked every weekend and made it” is the opposite of pushing back.
- Pushing back late. The moment the breakdown shows the gap is the moment to say so.
- Not asking why the date exists. A contract and a round number get different responses.
- Feelings instead of a breakdown. Bring the task list, the critical path, and the gap in days.
- One option. “Four more weeks” is a demand. A menu of scope, time, people, and risk is a plan.
- Quiet quality cuts. Skipping tests or monitoring and telling no one is the answer that ends interviews.
- Blaming the person who set the date. Your job was to make your side visible.
- Adding people as the answer. Brooks’s law. Helps only on parallel, understood work, and only early.
- No outcome. What shipped, what was cut, and did the cut come back?
- Confusing pushback with winning. The date holding and scope cut can be the right result.
Influence and Adoption
From “tell me about a time you influenced without authority”:
- The story where you had authority. If someone sponsored it from the start, you executed a mandate.
- Persistence as the method. Bringing it up until they gave in is attrition, not influence.
- Escalation as the first move. Borrowed authority is the last lever, used transparently.
- Winning the argument and losing the adoption. Agreement is free. What changed in the code six months later?
- Not knowing why they said no. State their objection in words they would sign.
- Making it about being right. The story is how people who did not have to care came to act.
- The lobbying story. Allies share evidence, not votes. Could every conversation be read aloud to them?
- The all-at-once ask. The first ask is a pilot on the service already in pain, with their criteria.
- No evidence. Benefits are opinions. A number from their own system is evidence.
- You paid nothing. Influence is credible in proportion to the work you did yourself.
- No durability and no dissent. Did it stick, and who never adopted it? The holdout is what makes the story true.
Telling the Story
From “tell me about a time an architecture decision went wrong”:
- The fake mistake. A replaced logging library affected nobody’s career.
- The humble brag. “We grew faster than I designed for.” The interviewer has heard it a hundred times.
- Blaming. The team, the requirements, leadership. The frame is what you decided.
- Hindsight framing. If it was obviously stupid, why did you make it? Show it was reasonable, then show what was missing.
- No detection story. What did you observe, who noticed, how long did you keep going?
- No numbers. Months of migration, hours of outage, a delayed launch.
- The generic lesson. “I learned to plan more carefully” is an apology, not a lesson.
- The story where nothing could have been known. Bad luck teaches nothing about your judgment.
- Eight minutes of context. Lead with the headline.
- Naming names. Confidentiality is itself a signal about judgment.
From “what is your biggest weakness?”:
- The strength in costume. “I am a perfectionist” is a refusal to answer, and the interviewer reads it as one.
- The confession. A disqualifying weakness with no mitigation ends the interview.
- The cured weakness. Nobody believes a fixed flaw. Say what it still costs.
- No instance. A weakness without the three-week review it caused is an abstraction.
- Blaming the context. The weakness is yours or it is not a weakness.
- A method that is only a resolution. “I try to be more decisive” is a wish. A method has rules someone else could follow.
- Choosing a weakness irrelevant to the job. Pick the one that touches the work; they will see it anyway.
- Over-sharing. Keep it professional. Talk about the behavior, not the history.
- Turning the method into a lecture. Two sentences per rule, tied to your own behavior.
- No residual cost. A managed weakness is believable; a cured one is not.