Motivation: A subsystem has grown complex, with many interacting classes, and client code shouldn’t need to know about all of them.

Intent: Provide a simplified interface to a complex subsystem, reducing the number of dependencies that clients need to manage.

This doesn’t actually add new functionality, but rather just bundles a series of subsystem calls behind an abstraction or convenient method so client code remains simple. This means just bundling things together.

public class SmartHomeFacade(
    private val lights: Lights,
    private val thermostat: Thermostat,
    private val musicPlayer: MusicPlayer,
) {
    fun arriveHome() {
        lights.on()
        thermostat.setTemperature(22)
        musicPlayer.playPlaylist("Welcome Home")
    }
 
    fun leaveHome() {
        lights.off()
        thermostat.setTemperature(16)
        musicPlayer.stop()
    }
}
 
// internal classes not exposed to the client
class Lights { /* ... */ }
class Thermostat { /* ... */ }
class MusicPlayer { /* ... */ }