Sunday, February 22, 2015

Practice - High cohesion, Low coupling

High cohesion: A class has a clear responsibility and all of the implementation of that responsibility is close together or in one place.  For example, to put all the logic to write to database in one class or several classes in a module, instead of letting every part of the application that needs to write to database implement that logic in its own class.

Low coupling: A module or class to be decoupled if it does not have many dependencies on other classes or modules.  It reduces the impact of a change in one module across other modules.  Loosely coupled software is easier to reuse because it doesn't have many other dependencies to be included.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.