The Big Issue with Magento 2 Extensions
Magento 2 has been slowly gaining momentum since its launch in 2015. Like with all new platforms, the migration to the newest release comes at a slow pace. This is understandable, as site owners are used to the M1 platform and might want to wait until all the bugs are fixed on M2. Luckily, Magento has released fixes for M2 and continues to roll out improvements for the eCommerce powerhouse. However, we cannot say the same for M2 extensions.
Before we move forward, let us establish something before continuing with this piece: This is not an “attack” or “jab” at extension developers. The message of this blog is not to cause conflict in the Magento community or point fingers. We are simply explaining the current environment in hopes that it will improve. Now that we have that settled, let’s dive into the issue.
A Different Format: Dependency Injection
Magento 2 is not the same beast as Magento 1 (and its many versions). Yes, they are similar, and yes, they function in the same manner. However, the same development practices used for extensions on M1 will not work the same on M2. How do we know this? Our team has installed multiple extensions (we will leave these names/brands out of this article) on several M2 sites, and as of the writing of this blog, only two have functioned properly.
So, what do we mean by the development practices differ? Magento 2 utilizes dependency injection, a new practice which was not available for M1. If you need the full definition or some examples, you can head over to Stack Overflow. The short version: You provide the objects that an object needs (dependencies), instead of having it construct them. It’s a time-saver, and makes testing a breeze. But, because this is a new implementation and developers may not be familiar with its practices, it changes the layout of development.
Dependency injection can force developers to adapt and begin to implement proper PHP coding (and we hope it does), but we also understand that old habits are difficult to break. However, until dependency injection is understood and used for new M2 extensions, we will continue to run into the same errors. We will continue to see extensions fail to install in composer or bombard our screens with errors during compilation.
We want to see Magento 2 grow beyond the heights of M1, but it will require improvements across the board. The platform and extensions must be mutually beneficial and evolve together.