All my current investigations are based on Magento 220.127.116.11 and Zend Framework 1.x versions.
First, it is worth to mention that ZF is a library of classes, which helps to create simple and high load applications. One may select from several ZF components or to use the whole library. The easiest way is to create a simple skeleton structure proposed by ZF developers.
The entry point of an application is index.php. This is where paths to code libraries are defined and the application is initialized. The Bootstrap class extends the functionality of Zend_Application component and creates all necessary objects, while sending the request to the controller and returning the response. See, everything is simple ;)
Magento is a complete application that consists of a great number of strongly interconnected core extensions. The structure is similar to the ZF. As well as ZF, Magento’s main entry point is index.php and application class which is located in core code pool Mage/Core/Model/App.php. Furthermore, the main application class and all of the magic is located here. app/Mage.php is just a wrapper in order to create the main class and access to it. Interestingly, Magento main application class does not extend ZF functionality. It is a separate application with its own initialization logic. The following chart shows the primary differences between Magento and ZF. The MVC model plays the major role. ZF MVC: Request is dispatched using routing rules and processed by an appropriate controller using necessary models. The result of the controller process is sent to View, which generates HTML/XML/JSON or other types of response. (Image was taken from http://mytech.dsa.me/)
Magento MVCUnlike ZF, there is no View object in Magento. Layout configs and Blocks are used instead. Blocks contain the application logic and layout configs allow to define when and which view template should be used to render the content. [caption id="attachment_3789" align="aligncenter" width="650"] Image was taken from http://mytech.dsa.me/[/caption] Magento follows the principle of thin controller. It means that the main responsibility of the controller is to initialize the layout and to render it. It is also worth to mention, that Magento does not use following ZF application-level components: Zend_Application, Zend_Layout, Zend_Form and Zend_View. Furthermore, Zend_Controller is not used as a parent class for Magento controllers. However, Request and Response classes extend Zend ones. And Magento uses ZF internalization components such as Zend_Locale, Zend_Date, Zend_Currency, Zend_Measure and Zend_Translate. All database workflows are based on Zend_Db, cache on Zend_Cache and sessions on Zend_Session. Zend_Http_Client is used in payment and shipping methods to send and receive requests to third party services. Magento API was build with Zend_Soap and Zend_XmlRpc. Below is the list of other used ZF components: