I'm learning about patterns of j2ee, can anybody tell me what the differences are between table module(domain logic pattern) and table data gateway (data-source pattern)? Thank you
2 Answers
Table Module and Table Data Gateway are both table level patterns, but with a very fundamental difference.
A Table Module is a Domain Logic Pattern in the sense it can contain the BUSINESS LOGIC related to a particular table. A Table Data Gateway is supposed handle Database interface only and is not supposed to contain any Business Logic. Read "database interface" here as "insert/update/delete/read rows from a table".
Please note Martin Fowler's definitions which clearly specify this distinction.
Table Module : A single instance that handles the business logic for all rows in a database table or view.
Table Data Gateway : An object that acts as a Gateway to a database table. One instance handles all the rows in the table. ( "handles" here typically refers to CRUD).

- 111
- 1
- 4
-
Remembering that Table Data Gateway and Table Module patterns are not opposites but working well together (Martin Fowler; Patterns of Enterprise Application Architecture; Chapter 10 - Table Data Gateway - When to Use it). – mold Aug 15 '23 at 20:50
for table module see : table module
for table data gateway see : table data gateway
The one is for mapping tables in database and the other is for mvc.

- 1
- 1

- 809
- 5
- 9