A personal memo space where Jeong Dongwoo practices code and records decisions.
Practice conveyor
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."
Resources that "must be closed once opened" β such as files, sockets, database connections, locks, and temporary directories β must be handled differently from ordinary values. The scope that acquires a resource is responsible for releasing it.
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
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.
Aggregation is decomposed into five stages: filter, group, sum, sort, and take, each made explicit in the pipeline. Accumulation is handled with a map, and top-N selection is separated into sorting followed by slicing. Monetary amounts are represented as integers or decimals, and group keys are normalized before grouping.
This is the first structure to apply in functions that mix validation, authorization, and dependency failures. Close off failure conditions early, and keep the function body focused on the success path. Failures are returned as Result data rather than thrown as exceptions.