In the world of software and web development simplicity is a funny thing. We are always striving to make our work and our product simple: simple to understand, simple to use, and simple to maintain. This is one of the many reasons we use Drupal as our development framework here at Freelock. Adding a simple feature to a Drupal site is often as easy as downloading a module and turning it on.

For every simple need, however, there are a multitude of other similar challenges which require more specific solutions. In situations like this, the 'simplest' solution only serves a set of specific needs. This brings to light an interesting question: How do you serve a basic need in a way that can also prove useful in many unimagined scenarios?  What about in a way that is simple to use and maintain? The answer to this riddle, like so many riddles in the cosmos, is balance! We achieve this delicate balance between simple solutions and complex needs through extensibility.

Extensible software design, in plain terms, is the concept of making tools that serve our needs for the present and allow us to address unanticipated needs in the future. We could create a custom tool designed to serve a specific need in a reasonable amount of time. These kinds of tools work great for the person for whom this tool is developed (for a while), however many others with similar needs gain nothing from it. With just a little more work we create that same tool extensibly. Indeed, much of the power of Drupal itself comes from its extensible design. With an extensible core, a Drupal module can become more and more powerful and useful as time marches on - as opposed to becoming obsolete as change inevitably upsets everything we know.

Nia Technique partnered with us in our goal to develop extensible tools that can be shared and improved upon for years to come. In our first initiative together we've addressed the 'simple' need for contract and signature management. We started by looking at some of the modules available to fit this need and, while they were impressive, we couldn't find a module that fit our needs exactly. We didn't feel it was desirable to mangle an existing module to do something it wasn't designed to do. We recognized that we needed to build a custom solution, but we also recognized that Nia's needs (like the needs of the rest of the world) are likely to change over time. With this reasoning in mind, we began developing the Smart Contracts module.

Right out of the gate the Smart Contracts module gives us flexibility with contracts we haven't seen before in Drupal. We can create multiple contracts and assign them to multiple nodes. We can dictate the requirements of each contract (e.g. the user must sign a contract if it has been updated), as well as the behavior of the site with regard to collecting signatures and enforcing signature policies. Note that we do not explicitly define how each of these behaviors manifest; instead we created a framework to make it easy to configure on a case by case basis.

Whereas the Smart Contracts module provides the framework to provide such functionality, it is in the submodules that the magic happens. We started with a simple scenario when we developed our first submodule, ‘Smart Contracts - Products’. This submodule, developed for use with the Ubercart package, allows us to create multiple contracts and assign any contract to any product in an e-commerce store simply by navigating to the product's configuration page, entering a little information about how you want the contract to act, and clicking save. That's it! When a site user adds this product to their shopping cart they will be required to agree to the terms and conditions of the contract before they are allowed to complete their purchase. The user's signature is recorded in the database and everybody goes home happy.

The above example, I think we can all agree, is pretty simple; but this tool alone will help many people who need a quick and easy way to introduce contracts to their shopping workflow. Nia Technique has a more specific and specialized set of needs in mind: Membership contract management. Memberships are a unique type of product in that they are living, changing things. The terms may be updated periodically, which would prompt a need for its members to sign the updated contract, and then the user needs to be sent a request to sign the updated contract at login. The functionality required to support this process was not fully known to us when we built Smart Contracts, but because we used an extensible design we were able use Smart Contracts to facilitate speedy development of a solid solution.

Instead of having to create a whole new module or making changes to the Smart Contracts core, our extensible structure allowed us to develop a submodule tailored to meet Nia’s specific needs. The development time (and budget!) to handle this new scenario, with our extensible framework in place, was dramatically lower than it would have been to hack an existing module or come up with something new. Not only that, but we developed it without any need for concern about negatively impacting a functional system.

The true beauty of extensible solutions lies not only in the time and money saved, but in the idea that we now have two solutions for two common scenarios and there's no reason it should stop there. As time goes by we hope that we'll see the Drupal community offer many more 'simple solutions' that use the Smart Contracts core module to address the unique needs of other projects.

The Smart Contracts module, along with the Product submodule, are available at http://drupal.org/project/smart_contracts. While still a work in progress, we feel there's enough proven functionality there to add value to any site with product-based contract needs. There are still a few things we'd like dial in before we call it 'Done.' (is software ever 'Done'?) Nia's membership-oriented module caters to some site-specific needs so you won't find it posted just yet.

We look forward to refactoring that sub-module so the rest of the community can benefit from the solid ideas generated by our partnership with Andy Price and Patrick Ryan at Nia Technique. Above all, we are eager to hear from you, the community, and to take advantage of the opportunity to add strength to this project from your observations and contributions. Drop us a line here on the site or on our project site on Drupal.org. We are looking forward to hearing from you!Cart Checkout Page

Share this article with your friends!

Comments (0)

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.