One of the reasons Drupal is so powerful and will continue to grow is the vision. The vision manifests itself in two primary ways: the code and the community. While I have worked with many
open source projects, I have never seen one where the community drives the code and the code drives the community as much as it does with Drupal.
The best examples of this are Drupal’s hooks. At first glance, hooks are code patterns that allow developers to extend existing functionality without having to hack the original code. Drupal’s core makes extensive use of hooks, empowering developers to have enormous power to extend the system in an elegant and maintainable way. While many open source projects do not have a well developed hooks system, hooks are not new and several well planned projects such as Silver Stripe also have an excellent hooks system. Drupal goes beyond extendable core code and has achieved something very unique, a community driven philosophy of elegant extendibility.
The Drupal community has adopted a mantra of extendibility. This philosophy exhibits itself in the use of hooks in
contributed Drupal modules. Most open source projects have modules that can be used to extend the core functionality. Traditional modules do what the author intended and if you as a user need something different often you have to resort to hacking which leads to forking and a splintering of efforts.
There are significant technical advantages to hooks, but what is more interesting is the impact it makes on the community. Hooks drive coders to be more in tune with each other and what others may need in the future. One of the precepts of agile software development is to embrace new ideas as a way to drive continual innovation. Drupal developers allow and encourage new ideas from others in the way they implement hooks.
Example
We are working on a project that requires various types of content to be embedded with geo information. The primary sources of input are mobile phones. The general idea was to leverage 3rd party services such as Flickr, YouTube and Twitter to manage
content from mobile phones. Drupal has some great recipes for aggregating content from multiple sources via the feedAPI, feedAPI_mapper, embedded field and Twitter modules. Drupal also has some great geocoding modules, location and gmap. What was missing was a way to get all these modules working together.
At first I thought it would be a simple task of using the nodeapi hook to filter machinetags from the services and map them to the location module. Unfortunately, the default functionality of feedAPI and feedAPI_mapper saves tags to a vocabulary before nodeapi fires. However feedAPI_mapper has a hook that allowed us to create a prefilter to remove machinetags for special processing.
Next we ran into a problem with Flickr and YouTube; neither service cleanly outputs tags in their RSS feeds. We had to implement an API call to both to get a clean version of the tags. Again, feedAPI had a hook we could implement to do this cleanup. Once we had entered the data, we need a way to output it. Thus we implemented views API hooks so we could leverage its powerful means for designing lists of items.
Finally, we needed to attach geo information to Twitter. We used the Twitter contributed module and low and behold, it has a status hook you can implement where we can attach our geo data to the Twitter module's data without hacking.
Once everything was said and done, it was amazing that we could create so much custom functionality that leverages so many other modules without having to hack any of them.
Conclusion
The hooks system is a great piece of technology, but even more amazing than hooks is that Drupal community developers have adopted it as a pervasive philosophy. Every one of the developers of the above modules (and thousands more like these) have made a conscious decision to allow their modules to be extended. The underlying thought process is, “I do not know everything that should be done here so I will make it easy for others to add to my ideas.” This philosophy is at the very heart of collaborative innovation. It is also not the norm for many developers. If you can get a large team of smart people to contribute great ideas while encouraging additional ideas in the future, you can achieve unparalleled success. I believe that the code and the community continually reinforce each other, driving the project to new heights in collaborative innovation. This dynamic will serve Drupalers well for years to come.
Related Drupal Articles