Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal as framework

Can we use Drupal as a framework for larger application? Is it suitable for developing big application in its framework, or is there any limitation of it?

I want to use Drupal as a framework in my application. Is it worth?

like image 603
mrugesh Avatar asked Jul 11 '11 10:07

mrugesh


1 Answers

If you are looking for a development-framework, Drupal is probably not the right choice. If you are looking for a suite to build websites, Drupal is probably the right tool.

People often tell that Drupal is a CMF, where the F stands for Framework, but in reality, Drupal is simply a flexible CMS.

On a high level, web application framework are split into two categories: the MVC and the CMS. Model View Controller being what most people call a framework. CMS being simply a flexible CMS with application-development abilities.

In practice, what Drupal lacks is:

  • Proper architecture. Most things in Drupal, evolved organically; which causes inconsistency, unexpected behaviour and unexpected barriers. Not saying that Drupal is not build up properly: just saying it has not been architectured: designed as a whole.
  • Principle of least surprise. Many frameworks allow skilled developers to create sites in a few hours. With Drupal you must gain a lot of experience and best-practices before you can be confident to roll out websites on planning.
  • MVC. Drupal has a distinct database-layer and a theme(view) layer, but they are unconventional, and often misused. And certainly not after a structural pattern.
  • unopinionated behaviour: a framework can force certain methodologies, libraries or even encourage certain behaviour, but it should not have hardcoded/none-overridable defaults that dicate your end-product. Or, in English: Drupals core has many defaults that dictate how you are going to set up, layout and structure your website, regardless of your (clients') needs or wishes. Modules or addons come even momre often with behaviour and often looks built-in and/or hardcoded.
  • DRY, don't repeat yourself: Drupal heavily depends on repeating oneself. Its entire theme-system depends on copying pieces of code into custom files and changing tidbits. Its form-override system requires copying large parts of the default form into custom modules and changing the parts that one wants modified.

Many of these lackings are the main cause for delay and budget-slips, as seen in my +10years Drupal-experience. Where the unopinionated behaviour part has proven the most nasty one to most of the projects I was involved in. Apparent simple features or ideas prove to take up large parts of the entire budget; Tiny details eating away development-weeks; that last 20% taking not just 80% of the effort, but sometimes 300%.

Besides that, Drupal does not follow OO patterns, which (according to the general consensus) is a bad thing. There is no inheritance, not DRY-practice, no object-relation-mapper*) and no unittesting-practice.**).

This might all sound negative, but in reality, people manage to build nice Drupalsites despite all these "downsides". That is because they adhere to the defaults by Drupal mostly (standard where possible, addons where changes wanted, custom development when no other option is left).

*) In fact there is; in Drupal 7, PDO was introduced, but is not (yet?) used as ORM much/at all.

**) In fact: all of core and many contributions have tests, but these are integration tests and a rare unit-test. Integration-tests (DrupalWebTest) install a clean Drupal-codebase+database for each single test. Your average core-testsuite taking over 8 hours to run is not an exception. TDD is simply not (yet) possible.

EDIT Reading into your examples: Drupal is particularly bad in the area of "form wizards", though it has seen improvement in Drupal 7. Another notable lack, in Drupal, is a proper, programmable workflowing system. There are several modules that enhance or replace the simple workflow-system in core, but they are not easy, nor efficient (development-effort-wise) to program against. It sounds like the main features you want, are amoungst the most underdeveloped areas in Drupal

like image 187
berkes Avatar answered Sep 27 '22 15:09

berkes