Step by step or all at once?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
nedjo's picture

Big question #2: do we rewrite drupal.js all at once, or do we do it in a (long) series of small patches?

The issues to be addressed are many. There's the basic restructuring from its current form to an object-based structure. There's incremental and larger improvements to the methods:

  • improve the add/remove classes, as Konstantin has shown
  • improve the model for registering events--addEventListener rather than our somewhat clunky workaround in addSubmitEvent
  • gather a form input and submit it via AJAX, rather than the current hidden iframe
  • improve effects (collapse, resize) and expose them
  • make code reusable--e.g., pull out the various methods hard-coded in autocomplete
  • etc.

Then there's fixes to basic issues like (a) registering behaviours so that other behaviours know about them, (b) localization of strings, etc.

So, do we do this step by gradual step? Or can we do it all at once?

The first is our current method. Some examples I've been involved in: removeClass bug, http://drupal.org/node/58956, now resolved, but took a fair while for a change of five or six characters (and some explanatory comments). parseJson bug, http://drupal.org/node/59038, not yet fixed (please review if you can take a moment!). Improve event registration, http://drupal.org/node/51974, stalled.

Given that we're talking about major reworking, the prospects for getting significant changes done detail by detail may seem daunting.

But an "all at once" rewrite also raises issues. Individual changes can get lost or insufficiently reviewed amid all the others. It requires a high degree of ongoing peer review and collaboration to ensure the overall code standards remain high.

What's our best approach?