criticisms, comments on newest module please

Darren Duncan darren at DarrenDuncan.net
Wed Jan 22 13:50:31 CST 2003


On Wed, 22 Jan 2003, nkuipers wrote:
> First of all, I know everyone is busy, and that taking the time to critique a
> newby module is a bit of a hassle, so it's not a problem if I get no
> responses.  But since one of my goals this year is to improve my module
> writing skills, I figure that it is valuable to me to have peers review my
> work.  I'm not after criticism of the "what" (which will undoubtedly be
> fleshed out as new functionality occurs to me) so much as the "how" and "why",
> the style, the housekeeping within the module, etc.  Any comments or
> suggestions are greatly appreciated.  I'll roll out documentation when the
> technical aspects are satisfactory, of course.

At first glance the module looks quite satisfactory, although I don't know
much about what it is supposed to do.  I can look more closely at it
during the following few days, but at the moment I can offer these
suggestions:

- Put the "use strict" pragma above *all* lines in the file, except the
"package" line.

- Instead of saying "[action] if/unless [condition]", say either
"if/unless ( [condition] ) { [action] }" or "[condition] and/or
[action]".  I find code much easier to understand if the cause comes
before the effect, even if Perl supports the other approach as well.

- Do not export any symbols into the caller's namespace.  Since you are
already using objects, just let the caller say "Classname->func()" or
"$object->method()".  This makes calling code easier to understand, and
your functions or methods won't conflict with any that the caller declares
themselves.  Besides, in order for the caller to use the exported function
names in the way that exporting provides, they would have to say
"function( $obj, @args )" rather than "$obj->function( @args )".

That's all I can say for the moment.  Hope this helps. -- Darren Duncan




More information about the Victoria-pm mailing list