The Computing Series

Tradeoffs

AT3 — Simplicity vs. Flexibility

Classical logic uses exactly two truth values. This is maximally simple. It enables efficient hardware implementation — a single bit. It enables exhaustive testing — there are exactly two cases. It enables formal verification — proofs reduce to symbolic manipulation of True and False.

The cost is expressiveness. Real systems have states that do not reduce cleanly to binary. “Is this service healthy?” might be “yes”, “no”, “degraded”, “unknown”, or “recovering.” Forcing this into a binary produces false precision.

The engineering resolution is not to abandon binary logic but to be explicit about the mapping. Define a ServiceStatus enum. Write a function is_healthy(status: ServiceStatus) -> bool. The boolean interface preserves the simplicity guarantee. The enum preserves the expressiveness. The explicit mapping makes the tradeoff visible.

from enum import Enum

class ServiceStatus(Enum):
    HEALTHY = "healthy"
    DEGRADED = "degraded"
    UNHEALTHY = "unhealthy"
    UNKNOWN = "unknown"

def is_healthy(status: ServiceStatus) -> bool:
    # Explicit mapping from multi-valued state to binary statement
    # This is a design decision: DEGRADED maps to True here
    # A different caller might map DEGRADED to False
    return status in (ServiceStatus.HEALTHY, ServiceStatus.DEGRADED)

This is AT3 in practice: the boolean interface is simple; the enum is flexible; the mapping function is the explicit tradeoff point.


Read in the book →