Magento Inheritance Chain. Good or bad practice?

I am just starting with Magento (1.9). I read that Magento OO is designed, which is a good point, but after digging up the kernel and some third-party modules a bit, I find it strange that classes inherit others in the chain (this can reach up to 4 or 5 levels of inheritance).

Is this a good practice?


final class I4_TaskManagerOrderXml_Block_Adminhtml_System_Config_Button_Runnow_Orderxmlextends I4_TaskManager_Block_Adminhtml_System_Config_Button_Runnow_Import {} 

class I4_TaskManager_Block_Adminhtml_System_Config_Button_Runnow_Import
 extends Mage_Adminhtml_Block_System_Config_Form_Field { //some stuff }

class Mage_Adminhtml_Block_System_Config_Form_Field
 extends Mage_Adminhtml_Block_Abstract
 implements Varien_Data_Form_Element_Renderer_Interface
{ //some stuff }

class Mage_Adminhtml_Block_Abstract extends Mage_Core_Block_Template
{ … }

+4
source share
1 answer

Magento uses a lot of layers of abstraction, so it makes it more flexible so third-party developers connect to the code.

() Magento . , , .

OO: . , Magento :

  • Varien_Object, , getter setter Magento
  • Mage_Core_Model_Abstract, (, ).
  • Mage_Catalog_Model_Abstract, , .
  • Mage_Catalog_Model_Product, .
0

All Articles