โ† All POC Flashcard Decks

Architecture & System Design Flashcards

7 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Architecture & System Design flashcards as text
  1. What is the primary benefit of applying Dependency Injection (DI) in a Python application?

    Answer: It makes dependencies explicit and swappable, improving testability and flexibility

    DI decouples class creation from class use by passing dependencies from the outside, making it easy to substitute mocks in tests or swap implementations.

  2. In Python, which architectural pattern is best suited for implementing an audit log that reacts to state changes across multiple domain objects?

    Answer: Observer

    The Observer pattern lets domain objects emit events, and the audit log subscribes to those events without the objects needing to know about logging.

  3. When designing a Python system with multiple payment providers, which pattern best allows switching providers without modifying client code?

    Answer: Strategy

    The Strategy pattern defines a family of algorithms (payment providers) behind a common interface, allowing the active strategy to be swapped at runtime.

  4. What is the purpose of a Python `Protocol` class (from the `typing` module) in system design?

    Answer: To enable structural subtyping (duck typing) with static type checking support

    Protocol enables structural subtyping: any class implementing the required methods satisfies the Protocol without explicit inheritance, supporting duck typing in type-checked code.

  5. In a Python web system, what is the main advantage of using connection pooling for database access?

    Answer: It reuses existing database connections, reducing the overhead of establishing new ones per request

    Connection pooling maintains a pool of pre-established database connections that are leased to requests and returned when done, avoiding expensive connection setup on every query.

  6. Which Python design pattern allows you to add logging, caching, or validation behavior to a function without modifying its source code?

    Answer: Decorator

    Python's Decorator pattern (using @decorator syntax) wraps a callable to add behavior before or after the original function executes without changing its code.

  7. In a Python system following Domain-Driven Design (DDD), what distinguishes an 'Aggregate Root' from other domain entities?

    Answer: It is the sole entry point for modifying the aggregate's internal consistency boundary

    An Aggregate Root is the top-level entity of a consistency boundary; all external code must interact with the aggregate only through it to maintain invariants.