4

First of all this might not be the right place to ask this question, if this is the case please let me know where the right place is?

Currently there is the module best practice reference on http://devdocs.magento.com/guides/v2.1/ext-best-practices/bk-ext-best-practices.html

In the first few days with Magento2 I have tried finding out what the 'best' way is of doing things with Magento2 and there does not seem to be a place which tells any new Magento2 developers what the plan is for Magento2 (e.g. what is going to be deprecated) and how to take a new approach to development.

As an example load and save are now deprecated I found a bit of info on Deprecated save and load methods in Abstract Model but there does not seem to be any real guidance from Magento on this.

another example is: Magento 2: Plugin vs Observer because of previously mentioned deprecation of methods a clear guide from Magento itself would be really good, in the current best practices for module developers I can not find anything along the lines of 'When possible use Plugins as particular events might become deprecated over time'

My Question: is there a location where these kind of changes are set out and how to approach these changes as a developer?

2

I think the best place right now for Magento 2 best practices is the Magento DevDocs, particularly the Best Practices for Extension Developers guide. Magento is continuing to add to their developer documentation, and encourages anyone in the Magento community to help add to these best practices by opening a pull request to the DevDocs GitHub repo.

Some best practices I would follow based on your examples would be to avoid at all costs using any function marked @deprecated, and instead try to stick to using functions and classes marked with @api. If these methods or classes are removed from the Magento codebase, it will constitute a major version change.

As for Plugins vs Observers, either can be counted on as dependable ways of changing core functionality. Magento says about events and observers:

Working with events and observers is one of the main ways to extend Magento functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.