For the past few years the reusable application paradigm has been considered one of the major selling points of Django, however the common wisdom about what it means to make an application reusable isn't really accurate. This talk is going to discuss ways to truly make your applications reusable across any project.
The common wisdom about reusable application says to do things like let your views take arguments for things like the form class or the template name. However, that doesn't satisfy most of the real need for extendability: changing the business logic or altering models. This talk is going to look at ways to combat these limitations:
- Class based views
- By making everything overidable in a view you can absolutely minimize the need to "copy-paste" when changing the logic of things around.
- As seen in the admin.
- Do less
- Provide the absolute minimum at the model layer, and only small wrappers for the business logic users can implement their own logic to control how things happen.
- Related to the idea of "application frameworks". Providing the tools for others to build their logic around various helpers.
- Provide a concrete implementation, but allow swapping out of various layers.
- Don't like the Tag model, swap it out, want a new intermediary model, swap it out.
- Providing swappable backends to change behavior.
- Providing tools for others to build around.
By using these techniques you can develop reusable application that work beyond any single use case. Of course there are cases where you don't need any of these, and just need something that fits "traditional" reusable application paradigm, so this talk will cover when that works as well.