Don't just upgrade your module to Drupal 8, modernize it

Submitted by hussainweb on Sat, 09/24/2016 - 13:34
Skill level

Drupal 8 is a massive improvement in how we write PHP code - modern, reusable, and testable PHP code. This massive shift in programming style and jump in concepts has made the code in Drupal 8 appear very complex, which makes it difficult for a Drupal developer to upgrade modules to Drupal 8. Fortunately, the Drupal community has built lot of documentation, guides, and presentations on porting modules by listing change records for each functionality that used to exist in Drupal 7 and how to do the same thing in Drupal 8.

However, there is an even deeper shift required in our method of upgrading modules to fully utilize the benefits provided by the increased interoperability provided by Drupal core. There might be better ways to solve the problem than how the module did in the Drupal 7 era, and this is an opportunity to explore them. Even if the fundamental operation or structure of the module remains the same, it can still be restructured for clarity and discrete responsibilities.

In this session, we will discuss:

  • Restructuring the module’s responsibilities - even splitting out the core logic to reusable PHP components

  • New design patterns when designing modules for various tasks

  • How Drupal API’s have changed and become more powerful - especially the entity and configuration management systems

  • How the new programming style helps us in writing clean code and better structured code

 

Wherever applicable, I will talk about my experience porting and modernizing modules to Drupal 8, particularly the Token module, as I documented in a blog post. The above discussion will be accompanied by topics on specific tools and APIs like:

  • Composer

  • Configuration Management API

  • Entity API

  • Plugin API