The Facade: The High Council Interface
Provide a simplified, unified configuration interface to a complex subsystem of lattice wards.
package wards
// Complex Subsystem: Multiple detailed schemas
#SoulFirewall: {
packet_inspection: bool
drop_rate: float & <= 0.1
}
#AuraBalancer: {
frequencies: [...int]
sync_mode: "auto" | "manual"
}
#MindShield: {
telepathy_block: bool
psionic_resistance: int
}
// The Facade: A simple configuration entry point
#DefenseGridFacade: {
// Simple input parameters
securityLevel: "low" | "high" | "paranoid"
// The complex subsystem is managed internally
firewall: #SoulFirewall
balancer: #AuraBalancer
shield: #MindShield
// Facade Logic: Map simple inputs to complex subsystem configurations
if securityLevel == "low" {
firewall: { packet_inspection: false, drop_rate: 0.01 }
balancer: { sync_mode: "auto", frequencies: [440] }
shield: { telepathy_block: false, psionic_resistance: 10 }
}
if securityLevel == "high" {
firewall: { packet_inspection: true, drop_rate: 0.05 }
balancer: { sync_mode: "manual", frequencies: [440, 528] }
shield: { telepathy_block: true, psionic_resistance: 50 }
}
if securityLevel == "paranoid" {
firewall: { packet_inspection: true, drop_rate: 0.1 }
balancer: { sync_mode: "manual", frequencies: [432, 528, 963] }
shield: { telepathy_block: true, psionic_resistance: 100 }
}
}
// Usage: The user only interacts with the Facade
myBaseDefense: #DefenseGridFacade & {
securityLevel: "paranoid"
}
A Lattice Data Validation Ward network can consist of thousands of individual tuning parameters across firewalls, balancers, and shields. Exposing this complexity directly to an apprentice conjurer is a recipe for catastrophic misconfiguration.
The Facade pattern encapsulates this overwhelming detail behind a simplified interface. By interacting strictly with #DefenseGridFacade and setting a single securityLevel parameter, the underlying conditional logic automatically maps the user’s intent to the intricate web of constraints required by the subsystem. CUE’s rigorous validation ensures the Facade’s internal mapping is strictly compliant with the subsystem’s schemas.