I was wondering what is the right way to create a DAO pattern between the two options, which I explain below.
Scenario
I have a movie theater web application, with Filmand type objects Showing. This is a PHP application, but I think this question applies to any OO programming language ...
Option A: CRUD only
Create another class DAOInterfacethat defines the CRUD methods insert, get, updateand delete, and implement this interface in such classes as FilmDAOand ShowingDAO.
Thus, I will use the same method getto extract “all films for today” or “all films of a certain genre”, so I need to set some array of arguments to decide which objects to get ...
Option B: Essential Methods
Create a variety of interfaces, such as FilmDAOIntand ShowingDAOInt, define the methods that are specific to each individual object, such as getFilmsByDate, getFilmsByGenre, getShowingsWithDiscount, etc.
Question
Is it just a matter of taste, or is any of these approaches better than the other? And why?