Hi everyone,
While going through the codebase, I noticed that many of the controllers directly handle database operations. This approach works, but it can make the code harder to maintain, test, and extend as the project grows.
I’d like to propose introducing a Data Access Layer (DAL) (or alternatively a Repository/Service layer) to separate database logic from the controllers. Some benefits of this approach would be:
- Improved maintainability and readability
- Easier to add unit/integration tests
- Cleaner separation of concerns
- Flexibility for future changes (e.g., caching, switching databases, or handling more complex business logic)
As a first step, I could refactor a single controller to demonstrate the idea, and if it works well, we can apply the pattern to the rest of the project incrementally.
Would this be something the team is interested in exploring?
Thanks!
Hi everyone,
While going through the codebase, I noticed that many of the controllers directly handle database operations. This approach works, but it can make the code harder to maintain, test, and extend as the project grows.
I’d like to propose introducing a Data Access Layer (DAL) (or alternatively a Repository/Service layer) to separate database logic from the controllers. Some benefits of this approach would be:
As a first step, I could refactor a single controller to demonstrate the idea, and if it works well, we can apply the pattern to the rest of the project incrementally.
Would this be something the team is interested in exploring?
Thanks!