Posts

Coupling and (Tight vs Loose)

Image
Coupling in Java In object oriented design, Coupling refers to the degree of direct knowledge that one element has of another. In other words, how often do changes in class A force related changes in class B. There are two types of coupling: Tight coupling :  In general, Tight coupling means the two classes often change together. In other words, if A knows more than it should about the way in which B was implemented, then A and B are tightly coupled. Example :  If you want to change the skin, you would also have to change the design of your body as well because the two are joined together – they are tightly coupled. The best example of tight coupling is RMI(Remote Method Invocation). filter_none brightness_4 // Java program to illustrate // tight coupling concept class Subject {      Topic t = new Topic();      public void startReading()      {     ...