Another word on namespaces

Kent Frederic's recent post about Dist::Zilla minting profiles was a great overview of the subject, but because I try to follow best practices, I was struck by the section "A word on namespaces."

Kent recommends that if you're making an author pluginbundle, you should name it Dist::Zilla::PluginBundle::Author::$CPANID. This extra bit of namespacing makes life easier for many people in many ways. I was immediately convinced that he was right, and moved my author stuff into appropriate author namespaces

Today, I wrote a testing plugin for Dist::Zilla that runs a standard Test::CPAN::Changes release test. I thought this wasn't actually very clever, and I was surprised that nobody else had done it already. Well, I was wrong. Kent pointed this out within minutes of my release to CPAN - Randy Stauner had already written and released CPANChangesTests. I hadn't found it in my search on the CPAN. Luckily, mine isn't an exact duplicate. Mine lets you cheat on the filename (I use CHANGES currently).

In pointing this out, Kent suggested that testing plugins should be in a Dist::Zilla::Plugin::Test:: namespace. Again, I agree. It's obvious when pointed out. This allows easy differentiation between two disparate categories of plugins. Some plugins alter how your dist is build, released, etc: CopyReadmeFromBuild, InstallRelease, VersionFromModule. The testing plugins are quite different. In general, they provide one or several files for t/*.t or xt/*/*.t, and don't actually affect the build or release process at all. They're a special kind of plugin that users often want to list or search through, and they're actually not that similar to other Dist::Zilla plugins. I think it makes lots of sense to move them into a Test namespace.

Despite being the author of TestingMania, I only have the one testing plugin mentioned above. I encourage the authors of plugins used in my pluginbundle to rename them in future releases. I'll be doing the same, and I'll release new versions of my pluginbundle as the testing plugins it uses are renamed.

Comment from Randy - April 12, 2011 at 1:52 pm

Thanks for including me in the discussion!

Like you I originally chose a namespace consistent with the other plugins, but I also agree, the namespace is obvious when pointed out.

I deprecated Dist::Zilla::Plugin::PodLinkTests and separated it into Dist::Zilla::Plugin::Test::Pod::LinkCheck and Dist::Zilla::Plugin::Test::Pod::No404s.
It's simpler, and the names are now consistent with the underlying test modules they use.

I don't know why I did it the weird way that I did it before.
Sometimes we just make things more complicated than they need to be.

Also I noticed you released Dist::Zilla::Plugin::Test::CPAN::Changes last night,
so I deprecated Dist::Zilla::Plugin::CPANChangesTests in favor of yours.

Comment from Kent Fredric - April 15, 2011 at 5:46 am