Hacker News new | ask | show | jobs
by unoti 4518 days ago
I write my code as if there will be multiple user interfaces. Usually there are not multiple user interfaces, but thinking as if there will be has a positive impact on the code. Thinking as if there will be multiple user interfaces means putting as little code as possible into the views, since there will be more than one. Some of those user interfaces might not even have Django views and templates, such as a service exposed via Zero MQ. This naturally leads me to putting as much logic as I can either into the models, or sometimes into other modules which in turn use the models. About the only code that goes into views then is the glue that looks things up and gets things ready to be passed into a model.