Unmasking the God Object: Shifting from Shared Models to Shared Identity for Scalable Architectures
Early system development often leads to the creation of ‘god objects’ – centralized, ever-growing entities (e.g., a ‘shipment’) that accrue functionality from various system parts like compliance and billing. While seemingly simple initially due to reduced duplication, this shared model approach rapidly introduces tight coupling, making changes risky and fostering a complex web of dependencies as systems scale. The core issue isn’t that different system components care about the same underlying entity, but rather the erroneous assumption that they require the same model of that entity. Instead, a more robust architectural pattern advocates for different bounded contexts to maintain their own specialized models, unifying them only through a shared identity.
This architectural shift is often best understood through workflows, which illustrate how a seemingly single process (like a shipment’s lifecycle) is actually a series of handoffs between distinct system boundaries, such as sales, dispatch, and billing. Each boundary possesses unique concerns, rules, and data ownership, necessitating its own model of the ‘shipment.’ Identity is shared through business events (e.g., ‘OrderDispatched’), which act as lean notifications of business facts, not as comprehensive data replication mechanisms. For query purposes, data from these disparate models can be composed on demand for UI display without distributing underlying data. For command decisions, the crucial question becomes whether the decision can tolerate stale information. This allows contexts to build locally relevant, potentially eventually consistent, views of shared entities (e.g., a driver’s availability), reducing synchronous coupling. For scenarios demanding absolute real-time authority, direct synchronous calls remain an option, but should be carefully considered against the benefits of autonomous operation and re-evaluating data ownership.