http://www.perlmonks.org?node_id=371888


in reply to Regrettable module names

Talk about other people's modules at your own risk.

I'll risk it.

My complaint is about Class::Null. First of all it might help if the documentation clarified what the Null Class design pattern is supposed to be. Unfortunately it doesn't turn out to be that there is a Null object on which you can make any method call and get another Null back. (You can use overload to make your Null act like undef where appropriate.) Allowing you to chain method calls together. This is what I would have hoped for.

I can think of at least 3 perlmonks saints who have independently written what I would like Class::Null to be. I would happily write a version for release, but I don't have any decent name to give it, the obvious one already being taken. :-(

So, there is one useful CPAN module which is waiting on a decent name before it can be written. Any suggestions?

Replies are listed 'Best First'.
Re^2: Regrettable module names
by brian_d_foy (Abbot) on Jul 05, 2004 at 22:02 UTC
    I don't think that Class::Null is really the Null design pattern, despite what it says. The pattern is for a stand-in collaborator who doesn't do anything, not something you add to a module to handle calls to undefined methods. Your module shouldn't ever have to know it is using a null object.
    --
    brian d foy <bdfoy@cpan.org>
      I'd agree but I hate arguing over terminology. If someone cares enough about design patterns to have an opinion on what pattern they're using, I'm unlikely care enough to correct them. (I'm not a big fan of the design patterns movement. Shoot me.)
Re^2: Regrettable module names
by QM (Parson) on Jul 07, 2004 at 15:18 UTC
    I suppose Class::Null::Actually_Useful would be too facetious?

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re^2: Regrettable module names (fix it)
by tye (Sage) on Jul 07, 2004 at 17:00 UTC

    So you are complaining rather than proposing a tiny patch (to the tiny module) to replace sub{} with sub{$_[0]} ?

    - tye        

      Perhaps you mentioned the reference to overload? The needed changes to make the module do what I want are much bigger than what you said.

      Which wouldn't be a problem except that the changes also have the disadvantage of not being backwards compatible with the current module. (For instance the returned objects should be false rather than true, which could mess someone up who tests that an object is there by checking for truth.) That incompatibility is why I decided to not offer a patch.