OOP Principles Flashcards

1
Q

What is high cohesion?

A
High cohesion is when you have a class that does a well defined job. Low cohesion is when a class does a lot of jobs that don’t have much in common.
High cohesion gives us better maintaining facility and Low cohesion results in monolithic classes that are difficult to maintain, understand and reduces re-usability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is loose coupling?

A

It means that given two classes A and B they are mostly independent. If the only knowledge that class A has about class B, is what class B has exposed through its interface, then class A and class B are said to be loosely coupled. In order to overcome from the problems of tight coupling between objects, spring framework uses dependency injection mechanism with the help of POJO/POJI model and through dependency injection its possible to achieve loose coupling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly