After writing a few python appengine apps I find myself torn between two approaches to organizing my source code tree: wide or deep.
For concreteness, consider an internal application for a small consulting shop to manage business operations like contact management, project tracking & reporting, and employee management. The application might use key entities like: Company, Users, Contacts, Customers, Projects, Timesheets, etc. Without going into details, one can imagine that these models are cross-cutting across the functions of the website. This likely means there is some coupling.
In this example, is it preferable to organize in a deep-manner, e.g.:
models/
people.py
accounting.py
projects.py
foo.py
controllers/
reporting.py
employeeops.py
accounting.py
crm.py
views/
...
or a wide-manner, e.g., by "application":
people/
models/
views/
controllers/
contact-mgmt/
models/
views/
controllers/
time-tracking/
models/
views/
controllers/
project-reporting/
models/
views/
controllers/
I know all design involves trade-offs, so when responding can you indicate your preference and some reasoning (e.g., assumptions, modulating concerns, framework limits, scalability issues, code maintenance considerations, impact of development team structure, etc.).
Caveat: I haven't worked in python specifically. Having said that...
Wide, and I'll tell you why: It never hurts to be able to remove things quickly. In my career I am often asked to add things and given a relatively reasonable schedule on which to do it, but when something needs to be removed, the request almost never comes with impact analysis or time to mess around. When you break things out by major functional modules, you usually end up with a much less coupled design. It can be a real pain in the ass, but for those times when you absolutely have to get the work order module turned off by the end of the week, it is a life saver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With