Skip to main content
4 events
when toggle format what by license comment
Jul 22, 2020 at 16:24 comment added Olle Härstedt OK, so two points: 1) Is it possible to enforce this on a framework level? 2) If you have multiple writes, you might end up with something like read-compute-write-compute-write. You can collect all writes in one package by using the command pattern, but that's getting close to what I've written above. Remember, to enforce removing side-effects from business logic, you must restrain from injecting anything in the business logic except a command factory (what I call SideEffectFactory).
Jul 22, 2020 at 14:24 comment added Bart van Ingen Schenau @OlleHärstedt, except for logging, all of those can be done before and/or after calling the business logic function, providing the business logic with an in-memory representation. Or at worst a stream of data. For logging, I don't really have a solution to take it out of the business logic, but that is often ignored in testing anyway.
Jul 22, 2020 at 14:17 comment added Olle Härstedt So far so good, but what about other side-effects, like curl, read/write to the file system (e.g. unzipping a file), logging, etc?
Jul 22, 2020 at 10:27 history answered Bart van Ingen Schenau CC BY-SA 4.0