As we know, there are several ways of organizing scripts in a project.
All of them have positive and other negative points when faced with the need.
I will cite below ways in which I have seen and what I think of each, by MY experience.
Arrange by tables:
It is a direct and easy to understand way. However, this is for those who already know the context of the application. If it is something that desenv doesn’t really know it will get lost in the database and source.
Organize by domain:
Today I work a lot with MVC and DDD.
I confess that I adapt better with DDD. It makes more sense for me to organize the system in domains.
However, sometimes we add too much complexity to the structure of the project, if we do not follow this pattern correctly.
I recommend this.
Layering
Honestly, I’ve seen programmers get lost more in this model than in others.
It’s very easy for systems to be born with this pattern but with time get messy, just because each programmer understands a functionality in a different layer. This way, in a short time, the system becomes a "monster".
With regard to the DAO.
There is also another access standard that is repositories.
Instead of creating objects that directly access data, repositories are created that perform queries.
In this case, you can create repositories adhering to the business rule and not abstractions of the created templates.
Example: When we are creating a report we do several consultations in the same context.
It’s easy to predict that the best thing to do is to bring all the information at once and unlock the data on screen. Correct?
In this way, a repository could be created that meets this need for this report, for example, using the templates as patterns, parse, only.
Important:
This is not a silver bullet answer!
There are several standards out there and regardless of which choice, think about the lifecycle of the software you’re producing.
You won’t be the only one working on it.
Knowing the company you are working at, it is possible to reasonably predict the profile of the people who will be in your place in the future. This way, you can choose a standard that is easy to maintain and easy to scale.
Look, the fact is that there are several ways to organize your code, in addition to the two you cited... I recommend that you look beyond the technical part, the people who will work on the project in the future. Whichever shape you choose, choose for the ease of climbing and maintaining at the source. Unfortunately they do not do as much as they should, and I think your question is commendable. Congratulations!
– DiegoSantos
@Diegosantos could assemble a response with other forms of project organization?
– Costamilam
I published an answer as you requested. However, in my experience. It is not a universal truth, but I believe it can be useful to you. Good luck!
– DiegoSantos