Facing limited options, what design pattern could be useful to separate SQL / database access from the business logic? Quite sadly I can‘t use fancy frameworks and have to design a simple solution by myself. The program only queries some tables, so the other CRUD-operations can be neglected. Furthermore joins e.g. are not necessary.
A super simplistic idea would be to put all SQL queries in different methods of a class, but this is probably not very elegant.
Searching, I found DAO or the Repository Pattern. As I understood, the general approach is to implement get(int id) and getAll() to let‘s say get one or all stored orders of a company. This would be very inefficient, if the programm let‘ say just needs to process all orders placed yesterday.
I would be very gateful for any advide.
Aucun commentaire:
Enregistrer un commentaire