There’s never been a better time to upgrade to Magento 2. Not only is it faster and better looking than Magento 1, but it’s the new standard for Magento support. And as extra incentive to consider an upgrade, 1.x will not be supported starting in 2018.
Knowing the world has one year before 1.x is no longer supported, now is definitely the time to be thinking about upgrading to 2.0. Fortunately, the upgrade comes with several features that improve the experience. Most people have heard about the new layout element and the UI library, but I wanted to share a few of the features that I like best.
Even more modular approach
Everything in the project is placed directly under the app structure and every module has its own VIEW directory. That means users can access any and all template, layout, js, and CSS files of a specific module. This makes a huge difference, especially for module developers who can now customize all over the place without risking or changing functionality.
Use of object interfaces
This makes for decoupling of modules and reliable upgrades. Interfaces simply expose a listing of methods and their specifications to be implemented by concrete objects. The use of interfaces instead of concrete objects means that you can swap out the concrete object with another that has the same methods. This decoupling of the modules aids in upgrades because any module communicating with this interface will continue using the same methods, even if the code behind them is now different.
Dependency Injection (DI)
This gives a simple, organized way of accessing/swapping resources. Dependency injection is a replacement for the Mage class in Magento 1.x. Adding your resources through the constructor method of any class allows easy access to other module object instances. DI “preferences” also provide abstraction to the implementation of the interfaces being accessed in your module code. This means you can add a preference of any interface and it will return an implementation of a class that you choose.
A plugin system
The plugin system makes quick updates to module class methods less cumbersome. The plugin system lets developers do a ton of interesting things, including changing the return value of any method call made on an object manager controlled object and letting users “listen” to any method call made on an object manager controlled object and then take programmatic action. But where Magento 1 is filled with real world conflicts where two modules or extensions try to rewrite the same class, Magento 2 makes it possible to easily merge plugins that observe the same method. The plugin system greatly reduces the potential for extension conflicts, and gives end users a way to solve any such conflicts on their own.
“Melding” is a new feature that merges layouts from multiple files based on the active controller, making them more modular and easier to target. This is a huge improvement over inserting changes into a huge layout xml file, which can be hard to maintain.
Use of PHP Namespaces rather than snake case class names. This helps eliminate vagueness, since namespaces allow ambiguous names or classes with same name to co-exist. This makes applications more readable.
If you’re considering Magento 2 (and you should be, especially if you’re on Magento 1.x), a partner with experience building on the platform can help. Our team shapes the platform and the experience to the needs of the customer to elevate productivity and drive operational efficiency. Give us a shout; we’d love to help get you on the right path.