Tag: functions

  • Immutability Makes Everything it Touches Simpler

    Immutability Makes Everything it Touches Simpler

    It’s hard to write immutable objects. For example, it’s harder to write this: …than this: So why bother? Because immutability makes everything it touches simpler. Let’s look at an example that shows why. The Cache.ts file below stores values. It’s the .cache property in the HttpGateway.ts file. HttpGateway.ts caches requests to this.cache. Just skim these,…

  • No State Means Almost No Internal Dependency

    No State Means Almost No Internal Dependency

    Thanks to Yehonathan Sharvit and Bob Martin for this idea. State is why apps are so complex. When state is in multiple objects, you have to manage them: But what if there was no state, and instead… There was a single data map for the whole app? There’d be almost nothing to manage. Just functions…