Boundaries – Functional Core and Imperative Shell
Designing module boundary is an important factor on developing a software. As it grows, number of paths and its combination grows exponentially. Then, it becomes difficult to pick paths to test, since it’s not feasible to test all the possible paths.
One idea is to isolate modules into smaler pieces by making “values” as boundary, rather than the message communications. It reduces the dependency, and removes the complex mocking codes.
Another idea is to seperate modules into 2 different types, which are functional core and imperative shell. Functional core provides logics in a isolated manner. It has few dependencies and many paths, which is suitable for unit testing. Imperative shell provides the adapter functionality wrapped around the core. It has many dependencies and few paths, which is good for integration testing.