Problem statement
Design the object model and public APIs for a configuration loader that assembles an application's effective settings from several sources — built-in defaults, config files, environment variables, and explicit overrides — with a well-defined precedence, and exposes typed access to the merged result.
Operating context. One in-process library. Sources are layered so that later layers win key-by-key (defaults < files < environment < overrides). Callers read values through typed accessors (string, int, bool, list, nested section) with optional defaults and required-key checks. New source kinds (for example a remote key-value store) can be added behind one interface. Configuration is loaded at startup and then read concurrently; an optional reload must swap the effective snapshot atomically.
Out of scope. The file-format parsers themselves (assume a source yields key-value pairs), secret encryption/decryption, push-based watching of remote stores, schema migration of old configuration, and any UI for editing config.
What to produce. The class hierarchy (config source, layered resolver, typed value accessor, the immutable snapshot), the public APIs, and the merge/precedence algorithm. Be explicit about: how a new source plugs in behind one interface, how precedence and nested-key merging are defined, and how a reload publishes a new snapshot without tearing concurrent readers.
Requirements
The requirements come with Premium
PremiumThe statement above is free to read.