5 months ago by dags
Drupal 8 makes extensive use of object-oriented design patterns to create readable, reusable, and testable code. Being able to recognize these patterns and understand their purpose is essential to working with any OO system, let-alone Drupal 8.
This session will discuss the design patterns utilized in Drupal 8 with particular emphasis given to the Dependency Injection (DI) pattern. We'll explain the pattern, why its so valuable, and how its used in Drupal 8 core. We'll then introduce the Dependency Injection Container (DIC) and how to use it as a module developer by demonstrating its practical application in unit tests.
The following questions will be answered in this session:
- What is Dependency Injection?
- What problems does it solve?
- What is a Dependency Injection Container?
- Why is this relevant to me as a module maintainer?
- What are compiler passes?
- How can I use Dependency Injection to write unit-testable code?
- What are some best practices around Dependency Injection that I should be aware of?