ashwanikumarjha
Sat Jun 03 2023
The Active Record Pattern
popularised by Ruby on Rails
goes against the modularity provided by Nest.Js
.
Nest.js
encourages the use of the Repository pattern
.
Data Mapper/Repository pattern:
• Separates data access logic from business logic
• Data Mapper: Maps data between domain objects and the database
• Repository: Provides methods for querying and manipulating domain objects
• Promotes separation of concerns, testability, and maintainability
Active Record:
• Combines data access and business logic within domain objects • Domain objects encapsulate database interactions • Simplifies development by allowing direct manipulation of objects • Can make separation of concerns and independent testing more challenging