Table module and table data gateway patterns
I'm learning about patterns of j2ee, can anybody te开发者_如何学编程ll me what the differences are between table module(domain logic pattern) and table data gateway (data-source pattern)? Thank you
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).
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.
精彩评论