3 ms·
Ask HN: How have side-effects complicated your code base?
I recently read "Out of the Tarpit", where the claim was that state management and side-effects was a big cause of complexity in our code bases. Wanted to hear concrete stories of whether that was true.
A friend was telling me that he had to write a user onboarding flow involving external APIs like Stripe and Mailchimp. Writing it and testing it involved setup on staging accounts and mocking the objects that got returned from the service.
I was wondering if HN had any war stories about how side-effects really made your code base more complicated and made your job harder. Or maybe it wasn't, and you were able to find easy ways to mitigate state management/side effect complications?
- PaulHoule 5y agoNot as much as the lack of side effects complicates your code when you're struggling with concepts like "A Monad is Like A Burrito". The whole point of a lot of code is to have side effects.
- iamwil 5y ago> The whole point of a lot of code is to have side effects. Depends on the domain. For domains that have to interact with the outside world, there's no choice to have side-effects, but it can be contained. It's well known the Monad Tutorials don't do a good job explaining what they are--doesn't mean they're not useful in specific contexts. If you find them lacking, try looking into linear types, algebraic effects, or hexagonal architecture. They're all different approaches to the same problem.