Intermediate everything in Backend Dev, page 23

GC vs. Ownership: Two Paths to Memory Safety
Rust's ownership model provides memory safety at compile-time, aiming for C++-level performance without a garbage collector. This makes it ideal for systems programming where resource control is key. The footgun is assuming all "safe" languages are equal.
Rust's Lifetime Elision: When You Can Skip 'a
Lifetime elision lets you omit explicit lifetimes ('a) in function signatures. The compiler infers them from common patterns, like a function taking one reference and returning one.
RAII in Rust: Automatic Cleanup via Scope
RAII ties a resource's lifetime to its owner's scope. When the owner variable is dropped, Rust automatically cleans up the resource, preventing leaks. This applies to heap memory, file handles, and locks. The footgun: cleanup is deterministic, not like a GC.
Rust's `Drop` Trait: Automatic Resource Cleanup
Rust's Drop trait provides automatic, deterministic cleanup, like a destructor. It's used to release external resources like file handles or network sockets when a value goes out of scope. The key footgun: you cannot implement Drop on a Copy type.
Rust's Module-to-Filesystem Mapping
Rust's module system maps directly to your file system. A mod foo; statement tells the compiler to look for foo.rs or foo/mod.rs. This is how you organize any multi-file Rust project.
Cargo.toml: Rust's Project Recipe
Cargo.toml is your Rust project's recipe, telling the compiler what to build and what dependencies it needs. It defines metadata, production dependencies, and dev-only dependencies for testing.
Rust Methods: Attaching Behavior to Data
Rust methods are functions attached to your data structures, defined in an impl block. Instead of do_thing(my_struct), you call my_struct.do_thing(). The key footgun: instance.name() calls a method, but instance.name accesses a field.
Rust Item Visibility: Private by Default
In Rust, all items are private by default. Think of modules as locked rooms; you need the pub keyword to unlock the door. This is crucial for creating a public API or letting modules interact.
Rust Enums: Attaching Data Directly to Variants
A Rust enum variant can carry its own data, acting like a mini-struct. This is perfect for modeling states with different payloads, like a Result that holds either a value or an error. The footgun is using a separate struct to pair an enum with.
Rust's Two String Types: String vs. &str
Think of String as an owned, growable text buffer on the heap, while &str is a borrowed, fixed-size view into string data. This distinction is key to Rust's memory safety. Functions often take &str to flexibly accept both types.
Rust Slices (&[T]): Views Without Ownership
A Rust slice is a borrowed view into a contiguous sequence of data, like an array or Vec, without taking ownership. Use it to write functions that operate on parts of a collection efficiently. The footgun: a slice cannot outlive the data it points to.
Rust's Variable Shadowing: Re-binding, Not Mutating
Shadowing lets you declare a new variable with the same name, making the old one inaccessible. It's used to transform a value, like changing its type, without making it mutable. The footgun is confusing shadowing (let x = ...) with reassignment (x = ...).
Go Pointers: Memory Addresses, Not Math
Go pointers are street addresses for data. Instead of copying a large struct, you pass its memory address. This lets functions modify the original value and is critical for performance.
Go's `defer`: Guaranteed Cleanup
Go's defer statement guarantees cleanup by running a function call just before the parent function returns. It's perfect for closing files or unlocking mutexes right where you acquire them. The footgun: multiple defers run in last-in, first-out order.
Rust's Two Error Types: Recoverable vs. Unrecoverable
Rust splits errors into two camps: recoverable (Result) and unrecoverable (panic!). This compile-time distinction forces you to handle expected failures, like a missing file, while crashing on programmer bugs, like an out-of-bounds access.

Go's Garbage Collector: The Concurrent Cleaner
Go's garbage collector is a concurrent cleaning crew, freeing memory while your program runs. It automatically reclaims unused memory, preventing leaks without manual free() calls. The footgun is assuming it's free; excessive allocations create GC pressure.
Rust Traits: Defining Shared Behavior
Rust traits are like contracts that guarantee a type has certain methods, similar to interfaces. This lets you write functions that operate on any type with that behavior, like a summarize method for both articles and posts.
Rust's Borrow Checker: Memory Safety at Compile Time
Rust's borrow checker is a compiler-time accountant that prevents memory bugs by enforcing ownership rules. It ensures you never access invalid data or have conflicting writes. The main footgun is assuming references are mutable by default; they aren't.
Rust Ownership: Memory Safety Without a Garbage Collector
Rust's ownership model ensures memory safety without a garbage collector. Think of data as having one owner; when the owner goes out of scope, the data is dropped.
Caching: Write-Through for Safety, Write-Back for Speed
Write-through caching writes to the database immediately for data safety, while write-back delays writes for speed. Use write-through for critical data and write-back for high-volume updates.
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