Recently I had a discussion with colleagues about where a code snippet should reside within our django project.
For the sake of the question, let's say we are creating API for the super budget function
We have the following modules (an application in django jargon), each with persistence, business logic and API
- location, for GPS storage and distance calculation
- traffic, to estimate travel time
- promotion, for discount using promotional codes
- the quotation, for the calculation of the price, currently only depends on the location
Now we want to have a budget API to also consider the promotion.
It is natural for me to put the API under
quotation module, extending the existing API behavior and adding
promotion as a dependency
However, my colleague recommends the opposite: create a new API in
promotion and adding
quotation as a dependency
While the previous example is for illustration only, I would like to know what, in general, should be taken into account when placing the cross-sectional code.
Transversal concerns in the package structure by feature
Folder by type or Folder by function