|
|
| Line 585: |
Line 585: |
| -> 对于Dolibarr开发,建议使用 '''Active Record''' 链接模式,该模式提供了接近业务模型的优点,而不具有复杂性,也不过度隐藏技术。正是在这种模式下,开发、代码理解以及技术和/或功能维护似乎最有成效(然而,这是纯粹主义者和实用主义者之间的一场永恒的辩论,没有人真正正确,因为一切都取决于要实现的目标)。 | | -> 对于Dolibarr开发,建议使用 '''Active Record''' 链接模式,该模式提供了接近业务模型的优点,而不具有复杂性,也不过度隐藏技术。正是在这种模式下,开发、代码理解以及技术和/或功能维护似乎最有成效(然而,这是纯粹主义者和实用主义者之间的一场永恒的辩论,没有人真正正确,因为一切都取决于要实现的目标)。 |
|
| |
|
| ==Design pattern for Graphic interfaces (MVC)== | | ==图形界面设计模式(MVC)== |
| There are several design patterns for user interfaces (MVC, MVP, MVVM).
| | 用户界面有多种设计模式(MVC、MVP、MVVM)。许多人将此设计模式与使用模板框架的设计模式相混淆。这无关紧要。模板框架(见前面章节)仅与这些设计模式的“V”部分有关。 |
| Many confuse this design pattern with that of using a template framework. It's unrelated. A template framework (see previous point) is only linked to the "V" part of these models.
| |
|
| |
|
| -> Dolibarr uses the '''MVC''' Design Pattern. Part M is materialized by a DAO class containing the CRUD (Create-Read-Update-Delete) methods for accessing the table. | | -> Dolibarr使用'''MVC'''设计模式。M部分由包含用于访问表的CRUD(创建-读取-更新-删除)方法的DAO类实现。 |
| Many frameworks have chosen to put the C code part (Controller) and the V code part (View) in different files, or even separate directories. The maintenance seems easier on paper, in practice, you have to juggle constantly between a ton of files when your project become larger. In Dolibarr, the separation is made by a simple comment section. The part of code C (Controller) is therefore the code that follow the tag
| | |
| | 许多框架选择将C(控制器)代码部分和V(视图)代码部分放在单独的文件甚至目录中。从理论上看,似乎更容易维护,但实际上,我们必须不断地在n个文件之间切换,因C与V紧密相连。同样,在Dolibarr中,隔离是通过一个简单的注释块完成的。因此,C(控制器)代码位于下述标记处: |
| <pre> | | <pre> |
| /* | | /* |
| Line 596: |
Line 596: |
| * / | | * / |
| </pre> | | </pre> |
| It is followed by the part of code V (Vue), well separated from the C by the tag
| | 它后面是V (Vue)(视图)代码,通过如下标记与C代码分隔开: |
| <pre> | | <pre> |
| /* | | /* |