Keep Effects at the Edges
agentultra.com·1d·
Discuss: Hacker News
Effect Handlers
Preview
Report Post

A practice I like to stick with when designing software is to keep effects at the edges. What I mean, in this article, by effects are all of those actions we ask a program to take that change the state of something outside of our program’s process space: allocating data on the heap, reading from foreign memory, reading and writing from files, making system calls, etc. I keep them separate from my core logic so that I can write clearer code that is easier to maintain and test.

Why Effects Should Be Contained

Without effects our programs would not do anything useful with the hardware and we wouldn’t observe our computers doing anything. No graphics. No sound. No networking. No way to get the results!

We need effects.

The problem with some effects is that they produce data…

Similar Posts

Loading similar posts...