iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
89.9k stars 26.59k forks source link

Row Data Gateway pattern #1312

Open iluwatar opened 4 years ago

iluwatar commented 4 years ago

Description:

The Row Data Gateway pattern provides an object-oriented interface to a single row in a database table, encapsulating the database access logic within a gateway class. This pattern allows for a clear separation between business logic and database operations, enabling more maintainable and testable code.

Main Elements of the Pattern:

  1. Gateway Class: Represents a single row in the database, providing methods for CRUD (Create, Read, Update, Delete) operations.
  2. Database Access Encapsulation: Database queries and updates are encapsulated within the gateway class, abstracting the underlying database interaction.
  3. Separation of Concerns: Business logic is separated from database access logic, promoting clean code architecture.
  4. Consistency: Ensures data consistency by managing row-level data operations through the gateway class.

References:

  1. Row Data Gateway - Wikipedia
  2. Row Data Gateway - Martin Fowler
  3. Patterns of Enterprise Application Architecture by Martin Fowler
  4. Project Contribution Guidelines
  5. Row Data Gateway

Acceptance Criteria:

  1. Create a gateway class representing a single row in a database table, with methods for Create, Read, Update, and Delete operations.
  2. Ensure that the gateway class encapsulates all database access logic, separating it from the business logic.
  3. Provide unit tests demonstrating the functionality of the gateway class, including CRUD operations and data consistency.
tao-ny commented 3 years ago

Could I work on this? @iluwatar

ohbus commented 3 years ago

Sure thing @tao-ny

Please mention a timeline for when can we expect a PR against this issue.

tao-ny commented 3 years ago

I will finish it within a week.

ShawnMaxShen commented 2 years ago

Hi, Can I work on this issue?

iluwatar commented 2 years ago

Ok @ShawnMaxShen

ShawnMaxShen commented 2 years ago

@BorisBDing bro, we can have a discussion privately. Your comment may make maintainer a little confusing. (For maintianer, me and Boris are working together~)

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.