How to achieve high cohesion, low coupling

Source: Internet
Author: User
Do a website including individual members and merchant member Merchant member's function including merchant login to modify business information change merchant account password Business Forget password merchant submit order and other functions write these functions into a class for example, the merchant class writes these functions in the form of methods and then partially complex functions are then separated into another A class or the next method to write to this merchant class want to ask this is not high cohesion if not how to be considered high cohesion simple functions such as display business information to modify business information business forgot password and business change Password write to business class in this does not calculate the cohesion


Reply to discussion (solution)

We all come up with a website that you've done. How to achieve high cohesion and low coupling

Plan the function module there's something you need to do while you're doing it, and just start thinking about it unless you have a lot of experience. Next, if it's a new project, then you might not be able to write anything. High cohesion low-coupling code still needs modification modification

Don't think about it much. You should think more about modularity (not what is called a function module), how to classify layers, and how to distill reusable code.
Many PHP developers use a class to implement the XX function as the starting point, itself has gone wrong.

http://blog.csdn.net/phpnewnew/article/details/6896582 This is the book recommended by Phpnewnew Blog
In the afternoon to find information when found a blog that wrote very wonderful also share to everyone 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.