4 ms·
The thing that really grates me is that Datamapper (the ORM) is that all their examples tightly couples the models to the database in direct contravention of th
by vidarh 15y ago
The thing that really grates me is that Datamapper (the ORM) is that all their examples tightly couples the models to the database in direct contravention of the data mapper pattern that gives it its name.
After all the entire point of data-mapper is that your objects don't know the details about how they're stored.
- grandalf 15y agolook at it as hints. It's not actually tightly coupled, as m of that stuff is optional sugar that allows for better optimization.
- vidarh 15y agoThat "sugar" is in the wrong place for a project that names itself after a pattern intended to keep the models and storage separate. If Datamapper actually tried to implement the datamapper pattern, you would've put it in separate mapper classes, not littered around the models.
- grandalf 15y agoFair point. Why don't you create a gist with an example of what the model + hint declarations would look like in separate classes. I'm not convinced that this distinction matters, but I'm sure the DM developers would respectfully take a close look at your insights. They are a really great group, very helpful on IRC, etc.
- vidarh 15y agoI would if I had time. Or they could just read the chapter of Patterns of Enterprise Application Architecture that they took the name from - it's the chapter right after Active Record :) Page 165. Martin Fowler went into a decent amount of depth in describing the pattern. His site also has a decent summary available for free. I don't think this is exactly is lack of awareness on their part, though - as someone else has pointed out, Datamapper actually implements the Active Record pattern. Structurally the two are very different.
- austintaylor 15y agoDatamapper implements the active-record pattern. It's the last thing you would expect.