DjangoCon 2021 | Clean Architecture with Django Rethinking basic assumptions | Paul Wolf

Published: 31 July 2021
on channel: DjangoCon Europe
14,890
like

Clean Architectures and related architecture patterns like Hexagonal and Onion architecture are intended to provide more maintainable code and lower technical debt.

Two parts of Django's architecture, the Django ORM and 3rd party Django REST Frameworks, make it difficult to get the benefits of a Clean Architecture. We look at ways we can achieve the benefits of Clean Architecture (CA) while using the Django framework.

What are the various Clean Architecture Patterns and what do they promise to do for you?

What is the ideal architecture pattern that Django supports?

Problem 1: most Object Relational Mappings including Django's do two things:

1) Specify the persistence model: normalisation of data, efficient storage, efficient lookup, etc.

2) Specify the business entity domain: what business objects does the domain manage

The problem is that these are two different goals handled in one framework component, the ORM.

Problem 2: REST frameworks have a heavy reliance on the ORM. This ties together the business domain to storage semantics making it hard to achieve some of the benefits of a Clean Architecture.

Two solutions paths exist:

Django can serve a clean architecture-like paradigm, under specific circumstances. But there is some confusion about what CA looks like in practice that causes developers to go for solutions that are the opposite of CA.

The other solution is a more fundamental rethink of how to implement and use ORMs and REST frameworks (including remote request frameworks like GraphQL).


Watch video DjangoCon 2021 | Clean Architecture with Django Rethinking basic assumptions | Paul Wolf online, duration hours minute second in high quality that is uploaded to the channel DjangoCon Europe 31 July 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 14,890 times and liked it like visitors.