Best approach for queries in web application

4 years ago

FeBus982
Member | 6
+
0
-

Which is the best approach in querying for tables and correlated ones in a web application?

It's my first time using frameworks, I think the canonical way should be:

  • model take care of all queries
  • presenter take care of building necessary data structure with data provided from model
  • template creates the output from data structure provided from presenter

In my opinion this is the most simple way in mantaining clean code.

I saw that in latte template is possible to make direct queries by using php code inside template (skipping presenter and model).

Which are the pros and cons for this approach? Is there a performance improvement with this approach at the cost of code maintenance?