I've been learning lots of new stuff about application architecture recently, and I want to get a sense from you, dear reader, of whether these ideas are of interest, and whether we should try and build some more resources (blogs, talks, etc) around it.
For me it all started with this question. At the end of my book I concluded on a chapter discussing how to get the most out of your tests, on the tradeoffs between unit, integration and end-to-end tests, and made some vague, flailing gestures towards topics I didn't really understand: ports and adapters, hexagonal architecture, functional core imperative shell, the clean architecture, and so on.
Since then I've managed to fall in with a tech team that are actively implementing these sorts of patterns, in Python. And the thing is, these architectural patterns are nothing new, people have been exploring them for years in the world of Java and C#. They were just new to me... and I may be over-reaching from my own experience here (I'm interested in your reaction), but they are perhaps new to the Python community in general?
It does feel like, as we mature, more and more of what were once small projects and plucky startups turn into complex business and (whisper it) enterprise software, so this stuff is likely to get more and more salient.
I came to it initially from the angle of testing, and the right kind of architecture really can help you to get the most out of your tests, by separating out a core of business logic (the "domain model") and freeing it from all infrastructure dependencies, allowing it to be tested entirely through fast, flexible unit tests. At Made it finally felt like the test pyramid was an achievable goal rather than an impossible aspiration.
The classic books (Evans on DDD and
Fowler on Architecture Patterns,
are classic, and anyone with an interest in this stuff should read them, but
if you're anything like me, then wading through all that public static void
main AbstractFactoryManager
gubbins is a bit wearing. Maybe some more
lightweight, Pythonic intros would make it all feel a bit more plausible,
a bit less enterprise-architecture-astronaut-ey?
Made's chief architect, the Venerable Bob, has written a 4-part blog series on the way we do things here, which I really enjoyed when I first started. They're a quick, practical intro to the basic concepts of DDD, ports and adapters / dependency inversion, and to some extent, event-driven architecture. And all in Python. (trigger warning: type hints).
There's more on io.made.com but those are the main four. We'd love to get some feedback on them, what's covered well, what could do with more explanation, and so on...
And: a very timely release from last Christmas, check out Clean Architectures in Python by Leonardo Giordani. It's really two books in one, part one being an intro to TDD, but part 2 has four chapters introducing very similar patterns to the ones I'm talking about here.
I also enjoyed a talk from about a year ago by David Seddon The Rocky River, how to architect your Django monolith, showing someone else starting to think about how we go beyond the basic Django models/views/templates architecture.
There's lots more at this listing of DDD resources by Valentin Ignatev, which I came across recently on twitter. It feels like something is in the air.
Bob's already had some good feedback to his blog posts, and Leonardo has had some good initial sales, so I'm sensing some interest from the Python community out there, but I'd like to sanity-check it.
I'd love to hear from you. Comments are open, or hmu on twitter, @hjwp
Patterns of Enterprise Architecture by Martin Fowler amazon.com / .co.uk
Domain-Driven Design by Eric Evans amazon.com / .co.uk
The book is available both for free and for money. It's all about TDD and Web programming. Read it here!
"Hands down the best teaching book I've ever read" — "Even the first 4 chapters were worth the money" — "Oh my gosh! This book is outstanding" — "The testing goat is my new friend" — Read more...
A selection of links and videos about TDD, not necessarily all mine, eg this tutorial at PyCon 2013, how to motivate coworkers to write unit tests, thoughts on Django's test tools, London-style TDD and more.
This is my old TDD tutorial, which follows along with the official Django tutorial, but with full TDD. It badly needs updating. Read the book instead!
The campaign page, preserved for history, which led to the glorious presence of the Testing Goat on the front of the book.
Comments
comments powered by Disqus