Elegant Solutions

Sep 23, 2013 7:49:00 PM John

There’s a recursive function that I wrote back in college to solve a particularly complex homework problem in only five lines of code that I’m still proud of a decade later. Those perfect, concise functions that do exactly what you need them to do (and no more) are incredibly satisfying to write... even if no one else is likely to delve deep enough into your code to ever see them.

It’s hard to even define what an “elegant Drupal solution” might be. I blame Drupal’s modular design and large open source library of modules. Each contributed module you add to your site is likely to come with several extra features that you don’t actually need. The modules are also likely to have been built by different people with different goals in mind, and coaxing them to work together to solve your particular problems can be tricky. Adding custom modules to a project often feels more like kludging an ill-assorted collection of parts together than selecting the right tools for the job at hand. The more contributed modules you add to a project, the less elegant it can feel.

However, if you forego the use of contributed modules in favor of designing everything from scratch, you’re clearly not using Drupal the way it was intended to be used. You’d be missing out on the key element that makes Drupal so powerful in the first place. Why spend eight hours designing a perfect solution from scratch when you can grab an existing module that solves a similar problem in ten minutes? It’s exciting how quickly you can get things done in Drupal by relying on other peoples’ work. And elegance can get expensive.

I definitely think the tradeoffs are worth it, and I’m happy with Drupal. I do still sometimes reminisce about the old days, though. C'est la vie.