Re:Code doesn’t have to be a mess
by nicoburns on Monday July 25, 2022 @10:52AM
(#32225177)
I'm a big fan of the "IO Sandwich". This is where you keep complex computation as pure functions as much as possible. And push the IO to the edges of the system. So you might have read-compute-write. This keeps the computation functions testable and composable.
[ Parent
| on HN ]
Re:Code doesn’t have to be a mess
by eyelidlessness on Monday July 25, 2022 @11:01AM
(#32225304)
In probably my favorite software-related talk[1] (certainly the one I most frequently share), this is referenced as “functional core, imperative shell”.
Does anyone know of a transcript of this talk? There is a link on the YouTube copy of the video, but it seems to be dead.
Re:Code doesn’t have to be a mess
by eyelidlessness on Monday July 25, 2022 @10:31PM
(#32233589)
Thank you for asking. I regret posting this without looking for a transcript first, especially since my capacity for consuming video/audio content has declined as rapidly as a lot of topics I’d be interested in have embraced video. I may well contribute to transcribing it if I find some free cycles.
Re:Code doesn’t have to be a mess
by Chris_Newton on Monday July 25, 2022 @11:52AM
(#32226177)
Yes, this is the way. In addition, often the internal and external representations of information will be different, in which case I normally prefer to keep any conversion or validation logic as close to the corresponding I/O as possible. Then all the internal computation logic only has to work with a clean and well-defined internal data model.