Loose coupling and tight coupling

Source: Internet
Author: User

Question: First, make it clear, what is loose coupling? What is tight coupling?

Answer: For example, two modules, a module and B module, when the correlation between the two is very much, it is called tight coupling, and vice versa, is loose coupling.

The way to achieve loose coupling, using the interface abstraction, when the association of two modules is only based on a few interfaces can be achieved, then, it should be called loose coupling, to achieve loose coupling is very necessary.

By the way, in the software design, should be separated from the level as far as possible, a few layers, each layer to do their job, cohesion poly, low coupling, at the same time, can be two modules of the relationship also abstracted out, for example, Ioc/di design mode, some people say spring ioc/di is meaningless, I do not agree, Because of the use of dependency injection, you can abstract the relationship of two modules, so that with some abstraction, such as the IOC container, more focused on a point, that is, spring in the IOC container focus on the new object, so that the various modules differentiated more clearly, each module focused on their own things.

Loose coupling and tight coupling

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.