语言和开发规则: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: 2017 source edit
Line 584: Line 584:


-> 对于Dolibarr开发,建议使用 '''Active Record''' 链接模式,该模式提供了接近业务模型的优点,而不具有复杂性,也不过度隐藏技术。正是在这种模式下,开发、代码理解以及技术和/或功能维护似乎最有成效(然而,这是纯粹主义者和实用主义者之间的一场永恒的辩论,没有人真正正确,因为一切都取决于要实现的目标)。
-> 对于Dolibarr开发,建议使用 '''Active Record''' 链接模式,该模式提供了接近业务模型的优点,而不具有复杂性,也不过度隐藏技术。正是在这种模式下,开发、代码理解以及技术和/或功能维护似乎最有成效(然而,这是纯粹主义者和实用主义者之间的一场永恒的辩论,没有人真正正确,因为一切都取决于要实现的目标)。
==Design pattern for Graphic interfaces (MVC)==
There are several design patterns for user interfaces (MVC, MVP, MVVM).
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.
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
<pre>
/*
* Actions
* /
</pre>
It is followed by the part of code V (Vue), well separated from the C by the tag
<pre>
/*
* View
* /
</pre>
This mode of separation has had a neutral effect on new developments but has made it possible to reduce the time required for maintenance and fixing bugs so significantly that it is not envisaged to switch to another type of separation (yes the findings made in real life are not always those expected by school theory). The important thing remains that there is always a separation between C and V, no matter how this separation is materialized, as long as it is (Reminder: Do not confuse the notion of separation of C and V with the notion of separation of the code to feed the data of a View and of the code to format the View, this a principle of separation relating to the Design Pattern of Vue, see next point).
==Design pattern for Views - Presentation==
There are frameworks that specialize in Vue Design Pattern, the part of formatting the screen seen by the user.
Old versions of Dolibarr used Smarty. This framework is an overlay to an already very powerful screen formatting framework called ... PHP. The benefits being much lower than the disadvantages, it has been abandoned in favor of PHP templates (.tpl.php file) which remain the simplest, the most universal, the most scalable and the most efficient, of the presentation frameworks.
Its only flaw is that it cannot guarantee 100% the deviations of a developer who would integrate into the View, a logic unrelated to the presentation (therefore other than code intended for generation, formatting, HTML output , test or loop logic). This point is however controlled by the validation mechanism of the project managers' code.
Here again, it is the experience and the observation of a better productivity performance that has motivated the abandonment of the external Presentation frameworks in favor of the PHP framework.
[[Category:开发]]
714

edits

Navigation menu