Yapc day 2

da on 2005-06-28T21:31:07

Well aren't I psyched, because I've gotten the oomph to follow day 1 with day 2. Ha, we'll see about day 3 tomorrow. Today I pretty much followed the databases track, with a detour at the beginning for 1.5 hours of perl 6 and Pugs. I'm quite impressed with how the perl 6 projects are coming along, though, as Eric/fishbot just told me, he was excited to see how the specs for Grammars have changed since he last looked at them. Now, I'll be excited to learn them when the design is finalized, and I'm excited for neat design development happening, but I'm not a language designer so I'll leave those discussions for those who are competent at such things.

In the database track, I saw a total of 4 Class::DBI talks of various sorts; I'm not convinced it's as useful as some claim, but I'm not actually warned away by the equally strong warnings I've heard from other smart people. Class::DBI seems just right for projects that can deal with a simple model. I suppose the first time I hit a wall with it, it'll be clear where the limitations are. But it seems it can handle many-to-many relationships, the thing I was most concerned about.

I need to look at Shawn Sorichetti's weblog, which will have interesting notes about IMA::DBI, and also I should track down the wiki for Class::DBI.

Casey West's talk about advanced Class::DBI included a number of modules to look at; which will shorten the amount of code you write, even further.

  • Database-specific extensions: there are subclasses of Class::DBI for each of the major DBDs; each has a 'set_up_table' method which will semi-automatically create the tables you need, at compile time (for better and worse).
  • Automatic Class creation: Class::DBI::Loader has a method 'find_class' to shorten class-creation code...
  • Automatic Relationships: Class::DBI::Loader::Relationships will set up simple cases of relationships. Also, Loader has a 'relationships' flag to look into.
  • Globally Unique Keys: ::Loader has parameter for 'additional_classes => [qw [Class::DBI::UUID]] whih uses/adds UUID field for able; it's DB independent and creates 16-character string UUIDs.
  • Automatic XML Serialization: Class::DBI::AsXML (I think this was written by Casey): has 'to_xml_columns' method which will dump XML definitions for your data (non-recursively, I think; it might need more work)
  • Automatic CGI Input: Class::DBI::FromCGI : the name is a misnomer; it can be used for many things besides CGI inputs. It will allow you to define columns/form-entries to untaint (as per type; you can specify integer, printable, etc... Pseudocode:
    use CGI::Untaint; 
    # create handler
    my $h = CGI::Untaint->new(CGI->new->Vars):
    my $a = $camoose->create_from_cgi($h);
    

    Class::DBI::AsForm creates populated or empty form.

Advice: Don't: write a Class::DBI subclass; that namespace is already too populated. Don't reinvent classes already on CPAN.

Do: write a Class::DBI mixin; use exporting to provide your plugin; and use Class::DBI internals.

I need to read up in the docs, and possibly ask Casey what he meant for the last two Do's.

Dan Friedman's talk on Class::DBI::DataMigration describes a framework for basically building a better database programatically, but mostly just requiring a YAML config file that will do the translations. Which certainly sounds easy.

As for non-Class::DBI talks: I enjoyed the Yahoo tlak on high-volume databases and the high-availability talk which suggests corporate appropriateness for MySQL (hm...). Finally, I got a little bit of graph theory schoolin' with Walt Makowski's talk on Graph Theory and one instance when to use trees instead of sets to describe data so it can be combined more quickly.

Gotta go run and catch a boat-cruise. :)

[edit: back. Boy that was a long auction. Why did I think it would feel shorter if it were on a 4-hour boat-cruise? The conversations were excellent, though.]