Capstone Blog: The (De)Merits of Community Code
Posted on Sat, 12/05/2015 - 18:40
Screenshot of the FAQ page in its current form
- It is MUCH easier to integrate the JS library into my site, without having to write countless, custom scripts just to call the library at the right time in Drupal’s bootstrapping process to create the necessary tours.
- The module comes with a pre-built, form-based UI for adding tours and adding steps within tours. This, again, makes the creation and integration of actual tours within the site extremely simple.
There is, however, one prevailing disadvantage to this contributed-module approach: Any contributed module is, by design, created for the widest possible range of use cases. It is meant to be used by the Drupal community-at-large, and so it is made to be applicable to as many generic use cases as possible. For normal usage, this is usually a benefit, rather than a problem. However, this approach limits the full capability of the Bootstrap Tour JS library itself.
As an example, I wanted to have my tours trigger certain events on the page, as the user clicked through certain tours. So, if a user reaches a certain step while learning how to use a form on the site, I might want my tour to trigger some sort of change in a form field, to better illustrate the concept being taught.
Unfortunately, using the Bootstrap Tour contributed module doesn’t allow for easy access to this robust API. Because the basic call to the JS library were hard-coded into the Drupal module, I didn’t have easy access to methods like the “onNext” method mentioned above. Instead, I was forced to write my own countervailing JS snippets to make my tours more interactive.
In summary, using community-contributed modules to do some dirty work can often make things easier at the start. You are essentially trading in control for ease-of-use instead. However, as you start getting more sophisticated with what you’re trying to do, that initial bargain proves costly, since your hands are then tied for the most part when it comes to control. Consequently, you may be forced to struggle even more in the long term, due to those short-term compromises.
TL;DR: Be mindful of using pre-built solutions. What’s easy at first may prove to be even more difficult later on.