At MADE.com i’ve been working on a new book with the chief architect, Bob
Gregory, in which we talk about application architecture and design. What
follows is an excerpt, a standalone chapter in which we talk about abstractions,
testability, and coupling.
Have you ever struggled with writing tests for a bit of code that has a lot
of dependencies? Someting involving I/O, interacting with 3rd parties, things
like that? Wondering whether end-to-end/integration tests are the only way,
and/or struggling with mocks that make tests hard to understand and evolve
Most of the other chapters are about specific architectural patterns, but this
one kind of stands on its own. When Bob and I first talked about choosing the right
abstraction in order to enable testing, it was a real lightbulb moment for me, so
I’m really interested in what people think — does it help you?
You can follow the progress on the new book at https://github.com/python-leap/book/,
and you can read the Early Release edition on Oreilly Safari (sign up for a free account if you
need one) (and apologies for the title, we’re working hard to convince O’Reilly to change it)
Allow us a brief digression on the subject of abstractions, dear reader.
We’ve talked about abstractions quite a lot. The Repository is an
abstraction over permanent storage for example. But what makes a good
abstraction? What do we want from them? And how do they relate to testing?
Commentscomments powered by Disqus