Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

While reading for the Nth time "The interface could be better but we're stuck with it now", I began thinking about ways to provide better backwards and forward compatibility. I have some ideas but nothing ground-breaking and I'd like to know about any other techniques out there.

A few approaches to changes in API or Interfaces are:

  • Don't. Stick with the sub-optimal past
  • Do. Let the new version croak, the old versions still available on CPAN
  • Deprecation cycle, see perlmodstyle:
    Backwards compatibility
    Modules which are "stable" should not break backwards compatibility without at least a long transition phase and a major change in version number.
  • Opt-in back-compat. Require users to ask for a deprecated feature (eg. TT2's V1DOLLAR)
  • Fork. Budd-off into a new namespace, leaving the old API behind
  • Provide a custom VERSION sub, "use Mod 1.1", perldoc -f use
  • use version; the module.

If you plan to evolve an API or want to release a non-binding alpha version, you could provide an alternate name that you document as stable, while the main-line can change. For example:

use Some::Module::alpha; # supported as is use Some::Module::alpha::warn; # as is, opt-in to future warnings use Some::Module; # may evolve without warning

Initially, "alpha" would basically be an proxy for the main module. Later it might be a backward-compatibility wrapper for the new interface. If the backward compatibility becomes impractical or restrictive then the alpha interface could become it's own package. The ::warn name extension (or "compat_warn => 1") could be used to opt-in to future compatibility change warnings.

I'm just brain-storming here and am interested in what others think.

What have other people tried?
What works and, importantly, what doesn't?
Are there already PM nodes addressing this?
How does Perl 6's module versioning system address these issues?
(The naming of v6-alpha inspired me in part)


In reply to Planning for Backwards Compatibility by bsb

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (4)
    As of 2020-11-29 10:45 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found