3 ms·
> you should keep the two kinds of code strongly segregated, with clean APIs between them Why _strongly_ segregated? Nothing stops you to write unit tests for
by dennisgorelik 11y ago
> you should keep the two kinds of code strongly segregated, with clean APIs between them
Why _strongly_ segregated?
Nothing stops you to write unit tests for the methods that should be covered by unit tests and integration tests for the functionality that needs to be covered by integration tests.
How would code segregation help?
- crdoconnor 11y agoIf the code is not well segregated you won't be able to write a clean unit test that tests the complex logic without also mocking a bunch of stuff. That test will also often break as you refactor the various connecting APIs it surrounds. Tests that break in the presence of changed API contracts (as opposed to bugs) are vastly less valuable than tests which only go red in the presence of a bug.