New module naming

2011-11-08 Thread Trystan
Hi. I've written few libraries I'd like to release on CPAN and I'm looking
for some advice on how to name them.

I found this idea in Head First OOADhttp://headfirstlabs.com/books/hfooad/,
chapter 5. It's somewhat like a very simple version of Key-Value
Codinghttp://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html#//apple_ref/doc/uid/20001838-SW1.
It's also very similar to
Object::Generichttp://search.cpan.org/%7Ejmahoney/Object-Generic-0.13/lib/Object/Generic.pmbut
I didn't use AUTOLOAD and I implemented 'equals' and 'contains'
methods
in order to make the objects searchable within a container.

Here's an example:

 my $a = tbd_name::Object-new();
 my $b = tbd_name::Object-new();

 $a-set( ID, tbd_name::String-new(1234a) );
 $b-set( ID, tbd_name::String-new(1234a) );

 print $a-get(ID);

 $a-equals($b) ? print yes;

 $container = tbd_name::List-new();
 $container-add($a);

 $container-search($b);  #which returns $a

What do I call this thing? I'm thinking the namespace would be 'KeyValue::'
or 'KeyVal::' Would that make sense? (That namespace doesn't seem to be
used.) Should this go in 'Class::'?

Thanks.


Re: New module naming

2011-11-07 Thread Trystan
 What about Object::KVC, Object::KVC::String, Object::KVC::List?

KVC it is.   I had actually been considering that.

In the Object::Generic documentation the author says his module should have
been in the Class:: namespace.

What is the difference between the Object:: namespace and Class:: namespace?

Thanks.


Re: New module naming

2011-11-07 Thread Trystan
On Mon, Nov 7, 2011 at 12:39 PM, Aristotle Pagaltzis pagalt...@gmx.dewrote:

 * Trystan trysta...@gmail.com [2011-11-06 23:30]:
  I found this idea in Head First
  OOADhttp://headfirstlabs.com/books/hfooad/, chapter 5. It's
  somewhat like a very simple version of Key-Value
  Coding
 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html%23//apple_ref/doc/uid/20001838-SW1
 .
  It's also very similar to
  Object::Generic
 http://search.cpan.org/%7Ejmahoney/Object-Generic-0.13/lib/Object/Generic.pm
 but
  I didn't use AUTOLOAD and I implemented 'equals' and 'contains'
  methods in order to make the objects searchable within a container.
 
  Here's an example:
 
   my $a = tbd_name::Object-new();
   my $b = tbd_name::Object-new();
 
   $a-set( ID, tbd_name::String-new(1234a) );
   $b-set( ID, tbd_name::String-new(1234a) );
 
   print $a-get(ID);
 
   $a-equals($b) ? print yes;
 
   $container = tbd_name::List-new();
   $container-add($a);
 
   $container-search($b);  #which returns $a
 
  What do I call this thing?

 Uhm. So when would I ever use this over a simple hash?



Re: New module naming

2011-11-07 Thread Trystan
 Uhm. So when would I ever use this over a simple hash?

Well I used it because the application I'm working on has a data model with
a lot of variation (I did this instead of creating a massive class
hierarchy). The accessors are the hash key scalar string. The 'equals' and
'contains' methods are delegated to the value objects when keys are eq.
(yes a wrapper object is required for the value but this could be
automated.)This allows fairly complex searches of a container of
objects.

This is based on an idea from a Java tutorial. I think it works better in
Perl than Java because the value objects can be of arbitrary type allowing
the composite hash based object to be more complex if needed.


New module naming

2011-11-06 Thread Trystan
Hi. I've written few libraries I'd like to release on CPAN and I'm looking
for some advice on how to name them.

I found this idea in Head First OOADhttp://headfirstlabs.com/books/hfooad/,
chapter 5. It's somewhat like a very simple version of Key-Value
Codinghttp://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html%23//apple_ref/doc/uid/20001838-SW1.
It's also very similar to
Object::Generichttp://search.cpan.org/%7Ejmahoney/Object-Generic-0.13/lib/Object/Generic.pmbut
I didn't use AUTOLOAD and I implemented 'equals' and 'contains'
methods
in order to make the objects searchable within a container.

Here's an example:

 my $a = tbd_name::Object-new();
 my $b = tbd_name::Object-new();

 $a-set( ID, tbd_name::String-new(1234a) );
 $b-set( ID, tbd_name::String-new(1234a) );

 print $a-get(ID);

 $a-equals($b) ? print yes;

 $container = tbd_name::List-new();
 $container-add($a);

 $container-search($b);  #which returns $a

What do I call this thing? I'm thinking the namespace would be 'KeyValue::'
or 'KeyVal::' Would that make sense? (That namespace doesn't seem to be
used.) Should this go in 'Class::'?

Thanks.