CSC/ECE 517 Fall 2007/wiki2 2 22: Difference between revisions
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
== Ruby's Active Record == | == Ruby's Active Record == | ||
Major features of Active Records | |||
* Automated mapping between classes and tables, attributes and columns. | |||
* Associations between objects controlled by simple meta-programming macros. | |||
* Aggregations of value objects controlled by simple meta-programming macros. | |||
* Validation rules that can differ for new or existing objects. | |||
* Acts that can make records work as lists or trees | |||
* Callbacks as methods or queues on the entire lifecycle (instantiation, saving, destroying, validating, etc). | |||
* Observers for the entire lifecycle | |||
* Inheritance hierarchies | |||
* Transaction support on both a database and object level. | |||
* Reflections on columns, associations, and aggregations | |||
* Direct manipulation (instead of service invocation like hibernate) | |||
* Database abstraction through simple adapters (~100 lines) with a shared connector | |||
* Logging support for Log4r and Logger | |||
== Crossing Chasms pattern == | == Crossing Chasms pattern == |
Revision as of 15:51, 20 October 2007
Object-relational mapping. Ruby's ActiveRecord is one attempt to allow an object-oriented program to use a relational database. The Crossing Chasms pattern is another. Look up several approaches to mapping relational databases to o-o programs, include hyperlinks to all of them, and explain how they differ. Report on the strengths of various approaches (making sure to credit the authors for their insights).
Introduction
Object Relational Mapping pattern is defined as - An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.
ORM
Ruby's Active Record
Major features of Active Records
- Automated mapping between classes and tables, attributes and columns.
- Associations between objects controlled by simple meta-programming macros.
- Aggregations of value objects controlled by simple meta-programming macros.
- Validation rules that can differ for new or existing objects.
- Acts that can make records work as lists or trees
- Callbacks as methods or queues on the entire lifecycle (instantiation, saving, destroying, validating, etc).
- Observers for the entire lifecycle
- Inheritance hierarchies
- Transaction support on both a database and object level.
- Reflections on columns, associations, and aggregations
- Direct manipulation (instead of service invocation like hibernate)
- Database abstraction through simple adapters (~100 lines) with a shared connector
- Logging support for Log4r and Logger