I think I don't need to explain in detail about plugins, preferences and observers. These are types of overriding or extending default magento functionality.
While overriding any magento core method/function, you must think first about which way to prefer. Whether it is plugin, observer or preferences. Observers can work only in some specific cases while in most of the cases you need to choose between plugin and preference.
Many times, I enters into the situation where I need to choose between around plugin and preference. You can imagine such case in that before and after plugins can't work for you. So this is really hard decision for me to choose between these two.
If you choose around plugin then it will call the method twice before and after the method execution. It means it may execute all code written in that method twice.
If you choose preference then your custom code or say custom feature might stop work if there is any change comes into the core method in future magento upgrade versions.
So this is really hard decision for me to choose between these twothe right approach. I am not sure how many of you had faced such situation but I would like to know about the best option to choose from this.
You can share your views with pros and cons.
Thanks,