← Back to context

Comment by specialist

12 days ago

With I/O in general, I've observed that socket, protocol, and serialization logic are often tightly coupled.

If they're decoupled, there's no need to mock protocol or serialization.

There's some cliché wrt "don't call me, I'll call you" as advice how to flip the call stack. Sorry, no example handy (on mobile). But the gist is to avoid nested calls, flattening the code paths. Less like a Russian doll, more like a Lego instructions.

In defense of mocks, IoC frameworks like Spring pretty much necessitate doing the wrong thing.