- Motivation
- To have a single instance that handles the business logic for
all rows in a database table or view.
- Summary
- A Table Module organizes domain logic with one
class per table in the database, and a single instance of a class contains the
various procedures that will act on the data.
- It is mapping of one business object to one table and much closure to Simple Domain Model.
- Unlike domain model it it does not have inheritance relationship.
- Usually Table Module normally uses a Record Set (508)
that mimics a SQL table.
- Multiple table module can use same record set.
- When to Use
- When domain logic is simple and data is in tabular form.
- Related Patterns
- Table Data Gateway
- The Table Module may include queries as factory methods. The alternative is a Table Data Gateway, but the disadvantage of this is having an extra Table Data Gateway class and mechanism in the design.
- he advantage is that you can use a single Table Module on data from different data sources, since you use a different Table Data Gateway for each data source.
- Related Technologies
- TODO
- Specific Considerations
- Table Module Vs Domain Model
- If the objects in a Domain Model and the database tables are relatively similar, it may be better to use a Domain Model that uses Active Record.
- Table Module works better than a combination of Domain Model and Active Record when other parts of the application are based on a common table-oriented data structure.
- In table Module you can't have direct instance-to-instance relationships, and polymorphism
doesn't work well. So, for handling complicated domain logic, a Domain Model is a better choice.
- References
- http://martinfowler.com/eaaCatalog/tableModule.html
|
|