What is the difference between loose coupling and tight coupling in the object oriented paradigm?

前端 未结 16 1988
粉色の甜心
粉色の甜心 2020-11-22 08:03

Can any one describe the exact difference between loose coupling and tight coupling in Object oriented paradigm?

16条回答
  •  深忆病人
    2020-11-22 09:04

    In object oriented design, the amount of coupling refers to how much the design of one class depends on the design of another class. In other words, how often do changes in class A force related changes in class B? Tight coupling means the two classes often change together, loose coupling means they are mostly independent. In general, loose coupling is recommended because it's easier to test and maintain.

    You may find this paper by Martin Fowler (PDF) helpful.

提交回复
热议问题