Hi Everybody,
If you want to know about the LCOM4(Lack of Cohesion of Methods) which sonar having , please see below example:
Cohesion is the degree to which the methods of a single class are tight together. When two methods in a class do not use a common attribute or a common method, it means that they share nothing and should probably not belong to the same class to respect the Single Responsibility Principle. In other words you can split your class into several new classes to gain modularity at class level.
Hope this will helpful to you to understand the LCOM4 concept which can be used for any programming language.
If you want to know about the LCOM4(Lack of Cohesion of Methods) which sonar having , please see below example:
Cohesion is the degree to which the methods of a single class are tight together. When two methods in a class do not use a common attribute or a common method, it means that they share nothing and should probably not belong to the same class to respect the Single Responsibility Principle. In other words you can split your class into several new classes to gain modularity at class level.
- LCOM4=1 indicates a cohesive class, which is the "good" class.
- LCOM4>=2 indicates a problem. The class should be split into so many smaller classes.
- LCOM4=0 happens when there are no methods in a class. This is also a "bad" class.
Hope this will helpful to you to understand the LCOM4 concept which can be used for any programming language.
No comments:
Post a Comment