Re:How to avoid brittle code
by crdoconnor on Tuesday March 29, 2016 @06:11AM
(#11380501)
If 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.
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?