Allan MacGregor, Director of Engineering at Demac Media, is one of the most recognisable figures in the Magento community. The author of Test Driven Magento Extension Development and Magento PHP Developer’s Guide, he’s also been one of the community members pivotal in the development of Magento 2.
As Magento gears up for the official launch of Magento 2, we asked Allan for his thoughts on its improvements from Magento 1.x, why he thinks the arrival of Magento 2 will help break the Magento community out of its “bubble”, and his advice for developers taking the plunge with the new version.
Magento 2 promises a lot for both retailers and developers alike. Do you think it will meet expectations, and is it worth the wait?
From a purely technical standpoint, Magento 2 has lofty goals as it’s not an easy task to refactor/rewrite an application of this size or complexity.
I think Magento 2 is very much on track to meet those goals and the expectations that they set so long ago; however, as with most things in life there are no guarantees, and Magento has to be careful during the transition process to Magento 2.
Magento 2’s biggest challenge is going to be the adoption rate by developers and merchants alike.
What upgrades/improvements do you think will have the biggest impact on Magento developers?
There are so many things that come to mind but if I had to pick two, I would say they would be the introduction of tests into the framework and the addition of Composer support and the usage of proper namespacing.
Why? Because by having truly modular design and namespacing, developers now have a world of options to build their apps, from seemingly including third party libraries to organising and architecting their code in more sustainable and modular ways.
And testing, of course, has many advantages, and frankly is one of the tools that will help this community grow and become more stable.
Any recommendations for developers/teams looking to get a head start?
Just one: get ready to read and practice a lot. Magento 2 has an initially steep learning curve, and there are many new things to learn and new concepts to absorb. From code generation, and new design patterns, to dependency injection, there are so many concepts that developers will need to know and master to use the framework effectively.
And there is the thing: most Magento developers so far have been working exclusively with Magento 1.x and nothing else outside it; they have not kept up with the improvements and changes on the PHP ecosystem.
In a sense, the Magento community has been operating in a bubble isolated from the PHP community at large; this will become very noticeable as soon as developers are trying to transition to Magento 2.
Now on the plus side, Magento 2 feels refreshing, there are so many good things about it and all the extra skills, patterns and knowledge that developers will need to acquire are no longer isolated. In a way, Magento 2 will break that bubble.
In your experience with M2 so far, have you found any common pitfalls that developers will need to watch out for?
For what I’ve seen so far, a lot of developers are having trouble grasping two main concepts in Magento 2, the first is how Magento uses Dependency Injection and the Object Manager, and secondly how code generation works.
As I mentioned before, most Magento developers have been working with Magento exclusively for years, which means they are used to doing things in a particular way. Magento 2 changes that and brings Magento back to the world of modern PHP, forcing developers to grow and update their skills if they want to keep working with the platform.
You’re renowned for your knowledge of testing and TDD in the Magento world. Any new considerations for Magento 2?
Yes, it feels like a brand new world. The Magento testing framework is a great and much-needed addition. Personally, I’m a big fan of PHPSpec and Behat and not so much of PHPUnit that in this case is the chosen testing framework for Magento 2.
So working with PHPUnit in M2 feels a bit weird to me, and so far I have ended doing too much mocking on my tests, now this might just be a sign that I need to change my design practices for Magento 2 and make the code more modular or might simply be a side effect of DI and the Object Manager.
I’m still experimenting with the best ways to write and test code in Magento 2 as well as trying to adapt my own workflow to it. One thing I can say for sure, and this is directly to all extension developers out there, there is no longer an excuse to release extensions into the marketplace without tests.
Can we look forward to a revised edition of your Magento PHP Developer’s Guide?
There is an updated version that came out a couple months back, and I don’t have plans to do any further books with Packtpub. However, I do have plans for a self-published Magento 2 book series that consist of smaller, narrow topic books.
As well, I will keep maintaining my new book Magento Test Driven Extension Development for Magento 2, that update will come likely by Q4 of 2016.
How do you think Magento 2 will help shape/support the future of eCommerce?
Magento is a big player in the world of eCommerce. Magento 2, in my opinion, will help to solidify that position and help the ecosystem grow even further. We have yet to see all that Magento 2 has to offer for merchants, but so far things look very promising.
For developers, Magento 2 is opening the doors to the whole PHP community at large; this is great for many things. We benefit from any new practices, tools, libraries, etc. as well as opening the talent pool to developers that might not have been interested in working on the platform before
I feel it is also important to mention that there a lot of people doing amazing work to promote Magento 2 all over the world. To mention a few Matthew Beane, Joshua Warren, Fabrizio Branca, and of course, Ben Marks.
As Magento 2 nears launch, we’ve prepared a series of technical tutorials to help developers and non-technical teams alike get a head start with the new platform. Sign up to be notified when the guides are available.
This article was originally published under Session Digital, which unified with Inviqa in June 2016. For more information about the unification visit https://inviqa.com/new-era.