Problems related to the modular development of loose coupling
Source: Internet
Author: User
The problem of loosely coupled modular development
Today's Web projects are becoming more complex and more focused on the reuse and stretching of project code.
For example, an Enterprise CMS project, there are "text" module, "Picture" module, "video" module, "Authentication" module and so on, and these modules are interspersed with each other, "text" module can have "Picture module", "Video" module needs "authentication" and so on, when these modules form a CMS, According to customer requirements, is a "streamlined" version, "standard" version, "enhanced" version, the more complex version, the more loaded modules, but how to maintain when the module is removed to ensure that the core library and other modules to work properly?! Or can you dynamically load other modules on demand?! Or to implement the agile development of PHP?!
------Solution--------------------
This, can only be considered more points.
In other words, think about it all.
There's no good way.
We are developing every day, if we can really synthesize it. Yes, I can.
------Solution--------------------
That's what I usually do. Custom Models and encapsulation classes
If you understand MVC, then you can see the following words are easy to understand, if you do not understand, first understand the next MVC and class bar
M is the model, the custom model is actually very simple, in the development of the fact that most of the things can be abstracted as models, each model can have many attributes (fields), so long as in the model, you can dynamically process the field (such as: Text field, select field, Picture field, editor field), as long as the model is created, Integration of common basic classes and basic methods, most of the content can be solved
C: Is the controller, after inheriting the public controller (method with you, such as template parsing method), if there are other requirements in the business, then in the current class controller to add the appropriate method
V: Is the view, the view is actually the foreground display, can also be understood as a template.
As long as there is a basic class, the remaining inheritance of the previous layer, so that the coupling can be reduced.
For example: Core class--foreground class, background class--foreground custom model generated classes, background custom model generated classes.
Subordinate, subordinate only depends on the superior, the superior and subordinate is not coupled, the sibling is no coupling.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service