Magento Developer Paradise 2011 - Day 3
Thursday, 09 June 2011The third and final day of Magento Developers Paradise actually only covered the morning, and had a slow start: Most of the attendees had a rough night before, so the conference room was only filling up slowly. Ofcourse, the presentations were certainly worth waking up for - and overall the Magento Developers Paradise was a perfect reason to come to Ibiza. Here's a compilation of the last day.
Sergey Shymko - Loose coupling of Magento modules
When writing Magento modules, having too many dependancies with other modules will complicate things when upgrading or removing modules. The modules depend on each other is referred to as coupling, and the less dependancies there are the looser a module is coupled: Therefor the goal is to write modules (and therefor classes) that are as loosely coupled as possible. The problem is that as soon as modules interact with each other, there is coupling. Referring to another module through hard PHP-includes and classnames is certainly not the preferred way.
Within Magento, the event-system allows for looser coupling: It's based on principles like the observer/observable pattern, but also a less known pattern called publish/subscribe messaging (pub/sub). While eventing is already mature in Magento, it is missing strong guidelines. For instance, the arguments passed to each event are not strictly defined - for instance, before saving a product it is common to modify the product-object, but after saving that product it might be less preferred. One of the ideas of Magento is to use some kind of parameter-class that defines which arguments are shipped with an event, and how these arguments should be used (for instance, access restriction). Another pitfal of the current eventing is that the event-names themselves are not following any standard. Instead of using XML-defintitions of events, Magento could incorporate the usage of convention over configuration, meaning that the event is automatically picked up if a file Model/Observer.php with the proper classname and methods exists.
Another way of loose coupling is already in Magento by using XML-code: Within the config.xml of each module, you can define cronjobs to be run, or define other tasks. A seperate manager within the Magento core (for instance, the cron-manager) is picking up these cron-definitions and running the cronjobs that are linked within. While the same XML also allows you to rewrite a specific core-class to your own class, using events is actually preferred - one simple reason for this is that numerous modules can use the same event, but a class-override can only be done once. At the end of Sergeys talk, there was a short Q&A: One of the interesting questions was asking about whether events could be sorted in some way to prevent problems. The answer of Sergey was quite to the point: If sorting actually causes problems, it shows an architectural flaw in your own module, not in the eventing system.
Yoav Kutner - eBay announcement
While the news was already made available the day before, an extra announcement was scheduled to let everybody know that eBay now owns 100% of the shares of Magento - in other words, Magento is taken over by eBay. Yesterday the news was already announced on the blogs of Magento and eBay, but Yoav took some small time to also share the news with the attendees of Magento Developer Paradise. He stressed that this does not change anything in the Magento sphere on the small term, while on the longer term eBay hopes to incorporate the Magento commerce system as core of their new X.Commerce platform. The main reason for eBay to buy Magento is actually to get the open source ecosystem, and not just the product - this could be actually very positive for the Magento project. Yoav: "This shows how succesful open source can be." Another good footnote is that when Magento Enterprise was released, some people were negative but it turned out to be a success. When Magento Go was released, some people were negative as well, but again it turned out to be a success. Let's hope that this new adventure shares the same fate.
Tin Cheung - PayPal
Tin from PayPal gave an overview of the various PayPal services out there: The Express Checkout has grown to be very popular, but various other Pro-products are interesting as well. Demos were given of Website Payments Pro (including an embedded PayPal payment within Magento itself), Payflow Pro Gateway and Website Payment Pro Payflow Edition. With the Pro-versions there are always some challenges - for instance, when the Magento shop offers creditcard payments the site needs to be PCI compliant. Hosted Pro - though a bit difficult to apply for - gives the benefit of hosting the entire payment within the Magento checkout-page (kind of an iframe-solution) without the need for redirecting to the PayPal website.
Jay El-Kaake - Advanced database install scripts
The last session of the day, and actually the last presentation of the entire Magento Developer Paradise event, gave some insight into the usage of database install-scripts - PHP-files placed within the sql-folder of a Magento module, that allows you to install or upgrade database tables when installing or upgrading Magento modules. Jay mentioned that you need to be carefull when placing numerous upgrade-scripts in your module, because you can end-up with numerous install and upgrade-scripts that are called sequentially, while actually a Magento module is installed for the first time. He also gave the tip that you could define your own setup-class in XML so that the $installer object in your upgrade-scripts refers to a specific installer-class with custom methods.
Aftermath
Unfortunately we had to catch a flight, so we were not there when the event was closed. We certainly look back at exciting days and liked the event as a whole very much. We would like to thank the Netresearch team for making all this possible, and certainly hope to be back for another Magento Developer Paradise next year.
