EasyTypeScript

Facade

TypeScriptDesign PatternsStructuralFacade

Provide a single, simplified entry point in front of a set of complex subsystems, so callers don't need to know the CPU, Memory and Disk have to be driven in a specific order.

Implement `ComputerFacade.start()`/`shutdown()`, each calling the three subsystems (CPU, Memory, Disk) in the right order and collecting their return values.

solve(action) builds a ComputerFacade and calls start() or shutdown().

Sample tests

Test #1Start sequence
Input: ["start"]
Output: ["CPU:start","Memory:load","Disk:read"]
Test #2Shutdown sequence, reverse order
Input: ["shutdown"]
Output: ["Disk:read:save","Memory:load:flush","CPU:start:halt"]
Test #3Deterministic — repeated start call
Input: ["start"]
Output: ["CPU:start","Memory:load","Disk:read"]