Chapter 13
Explain why side-effects must be as small as possible (in terms of code size).
In principle, side-effects should contain only the part of code that is a side-effect. However, when using existing libraries, the side-effect part often contains additional logic. This means that more code has to be tested, probably by using mocks. Since testing side-effects is more difficult than testing pure code, they should be stripped to the bare minimum.
What is the advantage of a protocol implemented without I/O?
A protocol implemented without I/O can be implemented only as pure code. As a consequence, such an implementation can be tested more easily and it can be reused on top of transport layers other than the original one intended.
What is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access