A personal memo space where Jeong Dongwoo practices code and records decisions.
Practice conveyor
An Idempotency Key is not merely a duplicate-request guard; it is a state-transition boundary design for POST APIs that involve uncertain external I/O.
Single-Flight is a concurrency pattern that merges overlapping calls for the same key into a single execution.
Structure of Arrays (SoA) is a data layout pattern that separates fields of the same kind into individual contiguous arrays rather than bundling all fields together in a single object. Where AoS (Array of Structures) creates an "array of particle objects" like `Particle[]`, SoA creates a "bundle of per-attribute arrays" like `x[]`, `y[]`, `vx[]`, `vy[]`.
Code Card
If you only need the 100 slowest requests out of tens of millions, sorting everything does far more work than the requirement demands. All you need is to keep only the candidates that qualify for the top K. By maintaining a min-heap of size K with the weakest element among the current top K at its root, you only have to determine whether each new element is stronger than the root.
A Bloom Filter is a probabilistic data structure that approximates membership without storing every element in the set directly, relying instead on a single bit array and multiple hash positions. When the result is "absent" (negative), you can be certain the element is not in the set; when the result is "present" (positive), the element may actually exist, or it may be a false positive. Burton Bloom's 1970 paper introduced this structure, which trades "tolerable errors (false positives)" for significant savings in space and lookup time.
Union-Find, also known as Disjoint Set Union (DSU), is a data structure that tracks which connected component each element belongs to. Initially, every element is its own independent set; `union(a, b)` merges two sets, and `find(a)` returns the representative root of the set containing a given element.
A Fenwick Tree is a data structure used when you need to update a single value in an array while repeatedly querying prefix sums and range sums. In the original paper, Peter M. Fenwick called it a Binary Indexed Tree. The goal was to maintain a compact, fast cumulative frequency table required for dynamic arithmetic coding.
Asynchronous programs frequently deal with resources that must be returned after use, such as connections, work slots, and temporary upload sessions. The problem is that when you write acquisition and release as separate ordinary function calls, it is easy to miss the release call on one of the return, exception, or cancellation paths. An Async Scope Guard binds a resource's lifetime to its lexical scope.
A Configuration Snapshot is a pattern that consolidates multiple configuration sources (defaults, files, environment variables, and command-line arguments) into a single runtime configuration at startup, performing type conversion and validation once before freezing the result.
Dependency Injection with a Composition Root is a pattern where objects do not create their own dependencies directly; instead, the dependency graph is assembled at the application's startup point and the resulting objects are passed to wherever they are needed. A service declares "what it needs" through its constructor or function parameters, while the outer assembly layer decides "what to actually wire in."