I must say that this looks interesting and I hope to have time to look at it more closely. I do like your idea of eventually making the style configurable as I am seeing method names being generated as "StudlyCaps" instead of "separated_with_underscores", which is generally a more Perlish thing to do (see "perldoc perlstyle").
The one thing that really interests me about this is the potential to create a "standard" style for a particular shop. It can be nothing short of frustrating to have four programmers design four completely different styles of interface for modules going into a single project. I can see this alleviating this problem and, as you pointed out, reducing the overall number of coding errors. Code generators are a Good Thing.
Code comments: a proper test suite would be a good thing. I'd recommend biting the bullet and using Test::More. It's very easy to use and you may just get hooked. I also find that much of your code spans more than 80 columns. This will make it difficult for some who would wish to collaborate to work on your code as they frequently have editors set to this width.
Refactoring is also good, but a proper test suite will make this easier. For example, in Factory.pm, your method &createAttributes has a variation of the following construct repeated six times. Surely that can be reduced.
require PerlBean::Attribute::XXXX;
import PerlBean::Attribute::XXXX;
return PerlBean::Attribute::XXXX->new($opt);
I'm also wondering about the following line in your constructors:
bless ($self, (ref($class) || $class));
Is there any reason for that? Typically, if someone wants to call the constructor on an existing object, it's for cloning the object, yet I don't see this facility used anywhere. Did I miss something?
Summary: This was only a few minutes of glancing through the code, so I could have missed a lot, but I think this is an interesting idea and I'd like to see more of it. Keep us posted.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text) |