On Feb 9, 2007, at 9:49 AM, John Siracusa wrote:

> This is a fine idea, but I think the correct approach is to make a new
> Manager class that uses the existing Manager class internally.  That's
> a lot cleaner than trying to further augment the existing Manager.

This was ridiculously easy to implement to play around with as an  
initial stab

the code is below , just to give you an idea.

i'll be playing around with this sort of stuff for a few days, then  
pop something onto my svn if anyone wants to play around with it.

i really like this...
no,  i ridiculously like this!

instead of passing results into various functions to handle maps,  
foreach, and misc processing , I can just make a class for each  
result list type, and toss my functions in there.  plus with  
inheritance chains, I can just inherit whatever methods i need from  
other object classes.

this isn't for everyone -- in fact, it might be too OOP for most.   
but i see A LOT of utility here :)



base-classes:
        FindMeOn::Rose::DB::Object::ManagerResultProvider;
                drop-in replacement
                
                i just redefined get_objects -- so this wouldn't work with  
make_manager_methods -- but I already call get_objects directly for  
the performance boost :)


        FindMeOn::Rose::DB::Object::ManagerResultList;
                base result list class

application specific classes

        FindMeOn::Rose::DB::Object::UseraccountFindmeon::ManagerList_A
                has a sample routine

        FindMeOn::Rose::DB::Object::UseraccountFindmeon::Manager
                my $results= Rose::DB::Object::Manager->get_objects()
                becomes
                my $results= FindMeOn::Rose::DB::Object::ManagerResultProvider- 
 >get_objects( manager_result_class=>  
'FindMeOn::Rose::DB::Object::UseraccountFindmeon::ManagerList_A' )



====================================================
package FindMeOn::Rose::DB::Object::ManagerResultProvider;
use Rose::DB::Object::Manager ();
our @ISA= qw(Rose::DB::Object::Manager);

use FindMeOn::Rose::DB::Object::ManagerResultList;

sub get_objects
{
   my ($class, %kw_args)= @_;
   my $objects= Rose::DB::Object::Manager::get_objects 
( 'Rose::DB::Object::Manager' , %kw_args );
   if ( defined $kw_args{'manager_result_class'} )
   {
        bless $objects , $kw_args{'manager_result_class'};
   }
   else
   {
        bless $objects , 'FindMeOn::Rose::DB::Object::ManagerResultList';
   }
   return $objects;
}

1;
====================================================


====================================================
package FindMeOn::Rose::DB::Object::ManagerResultList;
# null
1;
====================================================


====================================================
package FindMeOn::RoseDB::Object::UseraccountFindmeon::ManagerList_A;

use FindMeOn::RoseDB::Object::ManagerResultList();
our @ISA= qw(FindMeOn::RoseDB::Object::ManagerResultList);
sub first_item_id {
        my      ($self)= @_;
        print STDERR "\n first_item_id = " . $self->[0]->id;
}
1;
====================================================


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to