Comparison
Functional core, imperative shellvsHumble object
Functional core, imperative shell
all the decisions are in functions with no I/O, and a thin outer layer does the reading and writing around them.
An arrangement where the interesting logic is pure and testable and a thin imperative layer performs the effects at the edges. It is the practical, framework-free version of the same idea hexagonal architecture states with ports and adapters, and it gets most of the benefit for a fraction of the machinery. The characteristic sign it is working is a test suite with almost no mocks in it.
Full entry →Humble object
the class that touches the framework has no logic in it, so the logic is testable without the framework.
Splitting hard-to-test code into a very thin piece that touches the untestable thing and a piece holding all the behaviour. It is the general principle under passive views, thin controllers and hexagonal adapters. It is the most useful single idea for anyone whose tests are slow: find the smallest object that has to touch the boundary and take everything else out of it.
Full entry →