Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • When people talk about ORMs, I think they're generally looking at them the wrong way. The more I work with them, the more I think that trying to marry an class and a table is a terrible idea. I recently worked on a system where I could do something like this:

    $server->disable;

    That mapped to a table representing dedicated server, but that class had several other ORM classes it needed to interact with. That particular method hid tons of complexity behind it, including logging, deallocating IP addres

    • I disagree, kind of.

      I agree that a direct marrying of a class to a table can be a bad idea.

      I disagree that the abstraction cannot be a positive thing.

      My non-CPAN ORM ignores the class to table link and models the data at an entity-relationship level.

      From there, it derives BOTH the classes and the tables.

      Some of those classes don't have a table ("Transient Entities", imagine doing FormMail with all the structure and support of an ORM, but not ever needing to actually store the data) or don't write (I have "View Entities", which are just a view).

      Many-To-Many tables don't have classes at all, they are used directly by the many-cardinality relations of the classes on each side.

      And so on and so forth.

      And surprisingly, the model holds up to scrutiny and stress amazingly well.

      You get all the normal Class::DBI magic, but you also can drop back to a more basic usage and generate raw SQL. Or hell, just add a View Entity and build a view into the database if you need something really curly.

      The problem is not so much that the abstraction is failing, it's that the abstraction is being done too naively. They aren't abstracting the right thing.