by Chris Shattuck
If you're a developer who has worked mostly in Drupal over the last several years and haven't come up for air and taken in the general direction of PHP application programming, you're in for an interesting ride. Many of us who developed our programming chops with Drupal have taken our cues from the Drupal codebase itself, where nearly all functionality is wrapped in functions, and where most big problems were solved in-house rather than being farmed out to third party libraries. One tendency has been to follow suit with our own code, which means that some of us have missed out one some major shifts in standard coding practices that other PHP applications and frameworks have embraced.
If we continue to take our cues from Drupal in developing our programming skills - which many of us will do if our primary work is in Drupal - then Drupal 8 presents us with a huge opportunity to upgrade our own coding practices. In one fell swoop, a huge amount of the code base has become object-oriented and large chunks of custom code have been replaced with dependencies on third party libraries, many of which come from the Symfony framework. It's been a tremendous shift in focus, and gives Drupal users like us a chance to evaluate how we organize our own code.
On one hand, these changes are significant enough to be overwhelming. In some ways, learning to work with Drupal 8 is like learning a whole new application. On the other hand, our previous experience with Drupal makes it a lot easier to see the evolution of specific techniques, which means that instead of learning complicated topics like Object Oriented Programming (OOP) in a vacuum, we have some very practical examples of what it means to replace outdated systems with more modern approaches. Doing something as simple as adding a new page to Drupal programmatically introduces you to concepts like class inheritance, controllers and YAML. We get to see why these concepts are important to achieve something we're used to achieving a completely different way in older versions of Drupal, which can give us something to hang our hat on and make the learning process a lot richer.
Most importantly, wrapping our minds around these new ideas gives us a much better toolbox to draw from when writing our own code and understanding other applications. If you've never used OOP before, you'll start to see how useful it is in comparison to using simple functions for modeling complicated ideas and relationships. You will feel like you've had weights tied to your fingers all these years. If you've never thought of namespacing or used Composer to find libraries to reduce the amount of code you need to maintain in your projects, a whole new world will open up to you. And Drupal 8 is a gateway to learning these concepts, and it's a practical gateway since it's likely that a lot of your work may already be in Drupal. In contrast to learning new Drupal-specific systems in past releases of Drupal, you're going to be learning components and structures that you'll recognize from all kinds of PHP applications from here on out.
I'm in the process of recording a set of videos to help developers prepare for the new ideas and tools used in Drupal 8. The first thing I wanted to do in the series, before talking about building a simple module, before talking about OOP, before diving into Symfony, was to drive home the opportunity that is at hand and make sure that viewers see that the underlying changes in Drupal 8 are actually really exciting. If you're feeling like you might need to hear a few more ideas around this, or want to help out a friend or team member to wrap their minds around how powerful upgrading one's skills to Drupal 8 can be, here's the video: