Major focus of declarative programming is on describing WHAT and not HOW. It would also be right to say that the web is built on principles of declarative programming. However, Drupal focuses more on how and that’s the main reason why the UI focuses on describing the involved process and not on the final result. Still, there is a good number of reasons that account for most successful Drupal projects being declarative.
Let’s understand the prime factors that contribute to increased usage of Declarative in Drupal.
1. Better, Clearer Code – Currently,diverse approaches are being used to build Drupal websites. However, with a proper standard configuration format, we can have the same type of configuration interfaces. When the developer takes a declarative-first approach for Drupal projects, it enables him create a better, clearer code.
2. More Reusable Solutions – The Drupal open source community has more than 1 million members. It has contributed modules aimed at extending the core capabilities of Drupal. Increased usage of Declarative programming has led to more reusable solutions in the Drupal open source community, that’s a good news indeed for the community members.
A broader world of use cases is available due to declarative forms and so it enables reusing the forms built in the field API or Webform in custom modules. It also makes possible to build or use those forms totally outside Drupal, thus opening doors for form-building tools based on particular workflow.
3. Better Experience for Site Administrator – Site administrators always expect to have a better experience from their Drupal website. However, that may not be possible in case the developer adopts his own approach that is different from the declarative-first approach. Declarative programming renders finer experience for site administrators, thus making it highly preferred for Drupal.
Factors described above indicate the importance of Declarative programming in Drupal. A good news in regard to this is that Declarative is already being used in Drupal by developers. A good number of Drupal developers in India and abroad are already making use of declarative programming in Drupal 8 for configuration. What they need to focus more upon is to see the ways in which they can make use of it on a wider scale.