7
In a system that tends to grow in number of classes and users, what would be the best approach to work with access to the database?
- create a generic CRUD? or
- create specific methods to insert and update each model class that is persisted in the database?
In my view the first approach has the advantage of writing only once the code to insert and remove and others, but has the disadvantage of not knowing previously the available Sqls and not providing complex queries. The 2nd approach has the advantage of simplicity, the ability to be specific, and the disadvantage of having to rewrite the code of simple queries.
What would be the best approach to the situation outlined?
then the second solution (simpler, but more time consuming) would be the most appropriate because it is more readable and efficient (in performance).
– Ricardo
In a second development moment, as the system becomes complex, yes, but there’s no reason to have that at the beginning of development.
– Leonel Sanches da Silva