Topic 1-1

Part 1 :

1.Model-View-Controller MVC

Model is the classes providing data, service related to data and 
business logic. This
class works directly with data and provides data for other elements.
 In a module,these  classes are contained in Model folder.
模型是提供数据、服务相关的数据和业务逻辑的类。这

类直接使用数据并为其他元素提供数据。在一个模块中,这些

类包含在Model文件夹中。
View is the classes which define data presented method (not update data). 
These classes are contained in 
the folder Block of module.
视图是定义数据,呈现的方法(不更新数据)的类。这些

类包含在Block文件夹块中。
Controller is the classes which control application stream. They receive 
input which is
requirement of users through HTTP request, transfer those 
requests to the classes
which process the requests directly. From the link, Router will 
get to Controller which
controls that link. In Magento module, these classes are contained 
in controller folder.
控制器是控制应用程序流的类。他们接收

用户通过HTTP请求的输入,直接处理这些请求的类

。从连接,路由器将获得控制器

控制连接。在Magento模块,这些类都包含在控制器文件夹。

2. Identify and describe principles of Event-Driven Architecture (EDA)

Event-Driven Architecture
这里写图片描述

Magento event

Event Listener & Generator: When an event happens, this element will Listen 
the
event, create signals of that event and send that signal to Event Engine.
事件侦听器和生成器:当一个事件发生时,该元素将侦听

事件,创建该事件的信号,并将信号发送到事件引擎。
Event Engine: When receiving signals of the event, this element will 
send them to
factor Client to process that event.
事件引擎:当接收到事件的信号,这个元素将发送到

因素客户处理事件
Client: When receiving signals of the event, this element will 
execute steps to
respond to that event.
客户端:当接收到的信号的事件,这个元素将执行步骤

回应这个事件

Question:

The order of events when several modules catch the same event ?
当几个模块捕捉到相同的事件,事件的顺序 ?

Order of event: The first loaded module will get the signals before others. 
The order
of loading modules depends on the name of module and configure of module:
事件顺序:第一个加载模块将得到其他人的信号。秩序
加载模块的名称取决于模块的名称和模块的配置:

- The module depending on another module will be loaded later than 
-  the module it depends.
如果一个模块依赖于另一个模块,将在它依赖的模块加载之后加载。

- Order of loading configure of module is as below:
- 模块的加载配置顺序如下:

*Mage_All.xml will be loaded first, module configure in this file
 will be loaded first
Mage_All.xml 将首先加载,在这个文件中的模块配置在将首先加载

*Mage_*.xml
*.xml
And file.xml will be loaded according to the order of the file’s name

file.xml 将根据文件的名称顺序加载

Part 2 :

1. List steps to add a new module

Step 1: Register module with the system by naming file configure 
(e.g. file Magestore_Test.xml into the folder /app/etc/modules/. 
File Magestore_Test.xml with
the content like this:
步骤1:通过系统命名文件配置注册模块(例如在/app/etc/modules/   
文件下,创建 Magestore_Test.xml 文件,内容如下:
<?xml version="1.0"?>
<config>
    <modules>
        <Magestore_Test>
            <active>true</active>
            <codePool>local</codePool>
        </Magestore_Test>
    </modules>
</config>
Step 2: Create code in folder /app/code/local/Magestore/Test. 
Files needed for module
will be shown in the next parts.
步骤2:在/app/code/local/Magestore/Test创建测试代码。模块所需的文件将显示在下一个部分。

2. Describe module limitations

Limitations of modules:
1. All activities of the system must go through modules and an action 
in Magento may involve some modules, thus the loading and running
 of Magento system are quite slow.
该系统的所有活动必须通过模块和Magento的行动

涉及到一些模块,从而加载和Magento系统的运行比较

慢。

2.Many modules working in the same system can lead to modules’ conflict
在同一系统中的许多模块都可以导致模块的冲突

Question

When the system runs, does it load all files in module? If not, 
when creating a new
object or extend class from a class without including class’s source file,
 why does the
system not show errors?
当系统运行时,它是否在模块中加载所有文件?如果不是,当创

造一个不包含类的源文件的新的对象或扩展类时,为什么

系统没有显示错误?

Answer

When running Magento, the system will just load files 
including the class which we called.
当运行Magento,系统将只加载我们调用的类。

Magento uses a magic function spl_autoload_register(‘name_function_autoload’); 
of PHP. When you create a new object or extend class from a class that 
doesn’t exist, the function name_function_autoload will automatically
 run before adding new or
extending from a class.
Magento使用PHP的魔术方法spl_autoload_register('name_function_autoload”)的;
system can immediately find the path and files including that class 
(due to rules of
naming in Magento).

当你从一个不存在的类创建一个新的对象或扩展类的时候,

函数name_function_autoload会自动运行在添加新的或

一个类扩展之前。系统可以立即找到该类的路径和文件(基于Magento的命名规则)。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值