2 ms·
It's not just about isolating DB interactions. Any code that deals with IO or creates side effects lives at the edges of the application. Vast majority of the
by yogthos 8y ago
It's not just about isolating DB interactions. Any code that deals with IO or creates side effects lives at the edges of the application.
Vast majority of the code is written pure functions that can be reasoned about independently of the rest of the application. This is not practical in languages that rely on mutable data because things get passed around by reference. As soon as you pass a reference to an object to a function that's used elsewhere you end up with implicit coupling that's difficult to reason about.
Of course, you could use immutable data structure libraries in imperative languages, but then it's completely on you to ensure that you never put any mutable data, such as an object reference, in those. At that point you might as well use a functional language.