How to achieve high cohesion and low coupling

Source: Internet
Author: User
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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.