How to achieve high cohesion, low coupling makes a website including personal members and merchant members features of merchant membership include merchant login modify merchant information modify merchant account password merchant forgot password merchant submit order and other features write these features into a class for example, the merchant class writes these functions to this class in the form of methods, and then some complex functions are separated into another class or written to this merchant class in the form of methods. it's not a high cohesion. if it's not a good idea, it's a simple function of high cohesion. for example, displaying merchant information, modifying merchant information, forgetting the password, and writing the password of the merchant to the merchant class are not counted as cohesion.
Reply to discussion (solution)
Everyone is here to talk about how to achieve high cohesion and low coupling with a website they have done.
Plan some features in the function module. you need to make improvements at the beginning unless you have a wealth of experience. Second, if it is a new project, you may still be unable to write high cohesion and low coupling code. You still need to modify and modify the code.
You don't have to think about this. We should consider how to modularize (not a so-called functional module), how to divide layers, and how to extract reusable code.
Many php developers start with a class to implement the XX function and are already wrong.
Http://blog.csdn.net/phpnewnew/article/details/6896582 this is the book recommended by PhpNewnew blog
In the afternoon when looking for information to find a blog that is very wonderful to write also share with you http://blog.csdn.net/yunhua_lee? Viewmode = contents