Relating to changes that I plan to make in my modules, I plan to add code that may significantly alter the use of those modules (for example, different order of arguments to key functions, etc), in addition to updating base code that will not affect the user interface. Obviously, I would not want to have a significant effect on any established code that is already using my classes, and while I can beta test with other users, full distribution and associated feedback is the best way to test these changes as with any open-source project.

So I'm thinking that if my module is My::Module, I would want to duplicate that and create My::Module::Beta, in which all significant interface changes would go. These would still be released as one perl package, but those that want to test the new versions can use My::Module::Beta, and if they want to revert back, it's a quick deletion in the use section. This would also allow me, when approaching the completion of beta testing, to insert warn statements in the My::Module code on those functions which might be depricated or changed such that users can be expected to switch over when My::Module::Beta changes are merged into My::Module.

Any other thoughts on this type of situation?

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

  • Comment on Introducing beta code into CPAN modules

Replies are listed 'Best First'.
CPAN version trick
by Fletch (Bishop) on Nov 06, 2001 at 23:04 UTC

    If you want to put a version on CPAN but don't want the general CPAN shell users to try to installing it, put a `_' in the version number (e.g. 0.40_01) in the tarball name. CPAN.pm will ignore that version unless it's explicitly requested (install F/FO/FOO/MyModule-0.40_01.tar.gz). Check perldoc CPAN for (slightly) more detail.

Re (tilly) 1: Introducing beta code into CPAN modules
by tilly (Archbishop) on Nov 06, 2001 at 23:49 UTC
    You cannot expect your users to reinstall your module between when you put in warnings and kill the old interface. For that reason on any publically used code, it is a very bad idea to break the documented interface if it has been used in production.

    If you are going to do it, then the new version at the least should be a new major version, and probably should get a different name. Otherwise if at all possible, I would provide a backwards compatibility interface.

    Yeah, it sucks. But the advantage of modularity is that you will provide an interface that others can rely on to not change as you change the guts. The deal is that they don't mess with your internals, and you won't break their code. Both ends of that deal are important, and I try to avoid relying on code from people who knowingly break documented APIs in released code.

      I agree that changing the interface is *bad*. When writing, I would try to avoid it if at all possible, and if necessary, rename functions to fix this; another advantage of perl's weak typing is that it's probably very easy to 'overload' a function to take arguments in a different order if that is changed, but again, I would (and will) try to avoid that. That said, there's other options to consider.

      That said, another thing that I've been doing, and a lot of others on CPAN apparently, is keeping the version number of what I would consider to be "use at your own risk" code at 0.xx. Once the code hits 1.xx, or any higher number, there's an implicit understanding that the code is well tested, and any additional updates are bug fixes and feature improvements, over mechanistic and behavior changes (until, of course, the next major number change). Certainly this is informal, but it seems to be consistent for module developers. Can this be a reasonable guarntee, particularly for newer (< 3 month old) modules that might yet have a large in-use distribution?

      -----------------------------------------------------
      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      "I can see my house from here!"
      It's not what you know, but knowing how to find it if you don't know that's important

Re: Introducing beta code into CPAN modules
by maverick (Curate) on Nov 06, 2001 at 20:33 UTC
    I think your approach is wise and well thought out. I'm about to tackle a similar problem myself with some of my own code.

    Perhaps distributing the Beta as a separate package would be better? That way it wouldn't be somewhat hidden. Anyone browsing CPAN directly would see it separately, and perhaps you could wire a message into the make sequence to notify people of the Beta. Thus, someone using CPAN.pm would also be made aware of it.

    HTH

    /\/\averick
    perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

      I prefer Masem's approach, if only because it's simpler (just one package to worry about). The only issues I can see with it are:

      • Reduced visibility of the beta code (which isn't necessarily an issue: you don't really want people finding beta code before a stable version that already does what they want, and when they grab the stable version, oh hey, here's a beta module to try out)
      • increased footprint (extra code means extra files that the user doesn't have much of a choice about downloading, which might be annoying for student users with fascist disk quotas to worry about).
      --
      :wq
Re: Introducing beta code into CPAN modules
by lachoy (Parson) on Nov 06, 2001 at 21:45 UTC

    This really depends on how many people are using your code. If you were making changes to LWP, you would have a much different strategy than if you were making changes to a module only a handful of people actively use. If only a few people use it, then just warn the folks using the module, make the change and be done with it. Otherwise six months from now someone using an older version of your module will have a problem and you won't be able to remember when you made a particular change permanent, etc. Who needs that?

    Also, I think it's confusing to distribute in the same module beta code that duplicates functionality of stable code. Most people will never use it (they just need to get a job done), so you've gone and confused them without any benefit (comments, patches, etc.) to yourself. The people who will actively use beta code are likely motivated enough to download a separate package from a separate site.

    All IMO, of course :-)

    Chris
    M-x auto-bs-mode

Re: Introducing beta code into CPAN modules
by rrwo (Friar) on Nov 08, 2001 at 09:20 UTC

    I think a name like My::Module::Beta is a really bad idea. It pollutes the namespace with junk. Better ideas:

    1. If it's such a radical redesign of the interface, consider using a different name altogether that better reflects what the module does;
    2. Increase the version number, and note that it's beta by putting an underscore in the version (ie, 2.00_01). Also note very prominently in the README and POD that the interface is redesigned
    3. Use different function or method names, and have the old function names call the new functions. In your docs note that the old interface is deprecated, and in a far future version remove them