tezvyn:

⚙️Backend Dev

Backend engineering, APIs, and databases

1086 bites

More in Backend Dev — page 17

Go & Rust77 sec read

Concurrent TCP server: Go goroutines vs Rust std::thread

WHAT IT TESTS: stdlib networking and concurrency. OUTLINE: both accept in a loop; Go spawns a goroutine per connection (go handle(conn)); Rust spawns an OS thread (thread::spawn moving the stream).

Go & Rust79 sec read

Purpose and mechanism of a Rust build.rs script

WHAT IT TESTS: Cargo's build pipeline. OUTLINE: build.rs compiles and runs before the crate, emitting cargo: directives via stdout to set link flags, env vars, and rerun triggers; used to compile C, generate code, or probe the system.

Go & Rust79 sec read

Rust async/await vs Go goroutines

WHAT IT TESTS: async execution models. OUTLINE: Go schedules goroutines on a built-in runtime transparently; Rust futures are inert until polled by an external runtime like Tokio, and async colors functions.

Go & Rust75 sec read

Sharing mutable state: Go mutex vs Rust Arc Mutex

WHAT IT TESTS: shared-state concurrency and compile-time safety. OUTLINE: Go uses sync.Mutex by convention; Rust wraps data in Arc<Mutex<T>> so locking is mandatory, enforced by Send/Sync and the borrow checker.

Go & Rust84 sec read

Associated types vs generic type parameters in traits

WHAT IT TESTS: trait design and type-level reasoning. OUTLINE: associated types fix one type per implementer; generics allow many impls; Iterator::Item is the canonical example. RED FLAG: claiming they are interchangeable or that generics are always better.

Go & Rust87 sec read

Value versus pointer receivers and interface satisfaction

WHAT IT TESTS: method sets and interface satisfaction. OUTLINE: value-receiver methods belong to both T and *T, but pointer-receiver methods belong only to *T, so a value of T may not satisfy an interface.

Go & Rust2 min read

When to panic in Go versus Rust

WHAT IT TESTS: error philosophy and panic boundaries. OUTLINE: both reserve panic for unrecoverable bugs and use values, Result or error, for expected failures; Rust's type system pushes more cases to Result.

Go & Rust2 min read

Rust borrow rules versus Go race prevention

WHAT IT TESTS: how each language stops data races. OUTLINE: Rust's aliasing-XOR-mutability rule plus Send and Sync make races a compile error; Go prevents them at runtime via channels, mutexes and the race detector.

Go & Rust87 sec read

Rust workspace versus single crate for plugins

WHAT IT TESTS: structuring a modular Rust system. OUTLINE: a workspace gives incremental compilation, enforced API boundaries via a shared api crate, and per-plugin deps; a single crate is simpler but recompiles wholesale and blurs boundaries.

Go & Rust84 sec read

Rust binary and library crates in one project

WHAT IT TESTS: crate structure and code reuse. OUTLINE: a binary crate has main and produces an executable; a library crate has lib.rs and is reusable; put logic in the lib and a thin main that calls it. RED FLAG: duplicating core logic inside main.rs.

Go & Rust83 sec read

Refactoring under Go simplicity versus Rust correctness

WHAT IT TESTS: how language philosophy shapes refactors. OUTLINE: Rust's type system catches broken invariants at compile time so refactors are guided; Go's explicitness keeps code readable but shifts safety to tests and discipline.

Go & Rust86 sec read

I/O Stream Abstractions

I/O stream abstractions like Go's io.Reader and io.Writer model data as a flow of bytes behind a tiny interface, so files, sockets, buffers and encoders compose interchangeably without each one knowing the others' concrete type.

Go & Rust87 sec read

Implicit Interface Satisfaction in Go

Go types satisfy an interface automatically by having the right methods, with no explicit implements declaration. This structural typing decouples implementations from interface definitions, so you can define interfaces around how you use a type without…

Python & FastAPI2 min read

Explain multi-stage Docker builds for Python and builder vs runtime

Tests separation of build-time and runtime concerns. A strong answer contrasts the builder stage (gcc, headers, wheels) with the runtime stage (slim base, copied artifacts, no compiler). Red flag: citing size alone while ignoring security and caching.

Python & FastAPI2 min read

How do you manage configuration and secrets for a containerized FastAPI app?

Tests 12-factor config separation and Docker secret hygiene. A strong answer uses pydantic-settings with runtime env vars, lru_cache, and keeps .env out of the image. Red flag: baking credentials into Dockerfile layers or committing .env files.

What are the key responsibilities for Nginx versus Uvicorn?
Python & FastAPI2 min read

What are the key responsibilities for Nginx versus Uvicorn?

This tests the reverse-proxy versus ASGI-server boundary. A strong answer gives Nginx TLS termination, static files, buffering, and load balancing, while Uvicorn runs the Python app and async workers.

Python & FastAPI2 min read

Why use an ASGI server like Uvicorn instead of the dev server?

Tests: dev vs prod environment distinction. Answer: Uvicorn is a prod server program; contrast dev server's constant restart/break/fix cycle with prod needs for performance, stability, and uninterrupted access.

Walk me through a basic Dockerfile for a FastAPI app
Python & FastAPI2 min read

Walk me through a basic Dockerfile for a FastAPI app

WHAT IT TESTS: Docker layering and build cache for Python containers. ANSWER OUTLINE: Slim base, install deps before app code to cache layers, expose port, exec-form CMD for Uvicorn. RED FLAG: Shell-form CMD or code-before-requirements, killing cache.

How do you inspect WebSocket close codes in FastAPI?
Python & FastAPI2 min read

How do you inspect WebSocket close codes in FastAPI?

Tests WebSocket lifecycle handling in FastAPI. Strong answers catch the disconnect exception, read its code attribute, and log 1000 for normal closures versus 1001/1006 for crashes.

Python & FastAPI2 min read

How do you handle slow startup without blocking the FastAPI event loop?

It tests FastAPI lifespan events and event loop hygiene. Use an async lifespan to offload blocking model loading to a thread pool, track readiness with a global flag, and return 503 for early requests. Never block the event loop in startup handlers.