What do people think about adding a big dose of convention to RDBO? 
By convention, I mean defaulting parameters to "standard" values
according to a formula (a documented formula, of course).  For
example:

    package My::Product;
    use base 'Rose::DB::Object';
    __PACKAGE__->auto_initialize;

Oh no, I forgot to set the table!  But what if it defaulted to:

    $class =~ /(\w+)$/;
    $table = $1;
    $table =~ s/([a-z]\d*)([A-Z])/$1_$2/g;
    $table .= ($class =~ /s$/ ? 'es' : 's');
    $table = lc $table;

Some examples:

    Class               Table
    -----               -----
    My::Product         products
    My::SpecialProduct  special_products
    My::Top100Product   top100_products

Now think of something similar for foreign key columns, relationship
column maps, and so on.

Pro:

* Reduces typing and encourages standardized naming for new development.

Con:

* May cause "unexpected" behavior in the case where explicit values are
  unintentionally omitted.

Thoughts?

-John


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to