What is composition and why can it be preferable to inheritance?
Composition builds behavior by holding references to collaborating objects. It reduces tight coupling to a base-class hierarchy and makes behavio
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 1141–1152 of 3610 questions
Composition builds behavior by holding references to collaborating objects. It reduces tight coupling to a base-class hierarchy and makes behavio
A subtype should be usable wherever its base abstraction is expected without breaking correctness or documented expectations. Prefer capability-f
Clients should not depend on methods they do not use. Split large interfaces into cohesive capabilities so implementations only take dependencies
High-level policy should depend on abstractions rather than concrete low-level details. Both sides depend on a stable contract, with dependency i
Middleware executes in registration order on the request path and unwinds in reverse on the response path. Authentication must run before authori
Bind configuration to a typed options class and validate it during startup. This surfaces invalid configuration early instead of failing during a
Problem Details provides a consistent machine-readable error body with fields such as type, title, status, detail, and instance. Avoid leaking st
Use an idempotency key scoped to the caller and operation, persist the request/result atomically, and return the original result for duplicate su
An ETag represents a version of a resource. A client sends If-Match when updating; the server rejects the write if the current version no longer
Keyed services register multiple implementations under distinct keys. Resolve the implementation by key when the choice is explicit and stable; a
A captive dependency occurs when a longer-lived service holds a shorter-lived service, such as a singleton capturing a scoped DbContext. This can
Accept a CancellationToken, pass it to cancellable downstream APIs, and honor cancellation rather than swallowing OperationCanceledException indi