Growing your Business Logic with Django
Last month we looked at Locality of Behaviour, and how focusing on that allows you to reduce churn as the complexity of your application grows. It’s time to apply that to the perennial topic of where you should keep your business logic in Django.
Django turned 19 this summer. Over those last two decades, it’s become quite clear: Django does a great job of solving the web problem quickly. Django has a grain. It wants you to do things a certain way. My contention is, by going with that, by leaning into Django, you can take advantage of Django’s strengths whilst maintaining the appropriate level of abstraction for your application.
I talk about Growing your business logic with Django because we’re always walking a line between not enough and too much structure, between chaos and over-engineering. As always, it’s a balance. It’s one that changes as our application grows, and so we must grow with it. The challenge is not, not really, where we put our logic, but rather how do we evolve that as our application grows? How do we make sure we can scale our code into the medium term? That’s our topic today.
§