Object-Oriented Metrics: LCOM https://www.computing.dcu.ie/~renaat/ca421/LCOM.html

Object-Oriented Metrics: LCOM

LCOM (Lack of Cohesion of Methods) as revised by Brian  Henderson-Sellers  in [HEN96]


CK originally proposed LCOM

Chidamber  & Kemerer proposed the original LCOM Lack of Cohesion metric in [CHI94]

Given n methods M1, M2, …, Mn  contained in a class C1 which also contains a set of instance variables {Ii} . Then for any method Mi we can define the partitioned set of

P = {(Ii, Ij) | Ii ∩ Ij = φ} and Q = {(Ii, Ij) | Ii ∩ Ij ≠ φ}

then LCOM = |P| - |Q|, if |P| > |Q|

=0 otherwise

LCOM is a count of the number of method pairs whose similarity is zero.


CK example from  [HEN96] LCOM as defined above


Based on M's as methods and A's as instance variables both of the above graphs of classes derive an LCOM measure of   8.

However it seems clear that the graph on the right  is a lot more intuitively cohesive.

Henderson-Sellers revised LCOM*

Henderson-Sellers revises the LCOM metric to normalise it for the number of methods and variables that rae present in the class:

Where the number of methods is m and the number of instance variables ( attributes) a set of  {Aj}  (j=1, 2, …, a). Let μ(Aj) be the number of methods which access each datum.

With this new measure the mteric is simplified an normalised.


References

[CHI94] Chidamber, S., R., Kemerer, C., K., A Metrics Suite for Object Oriented Design, IEEE Trans. on Software Eng., Vol.20, No.6, June 1994.
[HEN 96] Henderson-Sellers, B., Object-oriented metrics : measures of complexity, Prentice-Hall, pp.142-147, 1996.

Object-Oriented Metrics: LCOM 内聚性的度量的更多相关文章

  1. CSharpGL - Object Oriented OpenGL in C#

    Object Oriented OpenGL in C#

  2. Object Oriented Programming python

    Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...

  3. What is Object Oriented Design? (OOD)

    Object Oriented Design is the concept that forces programmers to plan out their code in order to hav ...

  4. Java - 面向对象(object oriented)计划 详细解释

    面向对象(object oriented)计划 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24058107 程序包括 ...

  5. OO开发思想:面向对象的开发方法(Object oriented,OO)

    面向对象的开发方法(Object oriented,OO)认为是好文章吧,拿来分享一下(转载) 面向对象的开发方法(Object oriented,OO) 从事软件开发的工程 师们常常有这样 的体会: ...

  6. JavaScript: Constructor and Object Oriented Programming

    Constructor :  Grammar: object.constructor Example: Javascript code: 1 function obj1() { this.number ...

  7. 面对对象编程(OOP, Object Oriented Programming)及其三个基本特性

    一千个读者,一千个哈姆雷特.对于面对对象编程,书上都会告诉我们它有三个基本特性,封装,继承,多态,但谈起对这三点的见解,又是仁者见仁智者见智,感觉还是得多去编程中体验把 . 面向对象编程(OOP, O ...

  8. Python学习札记(三十) 面向对象编程 Object Oriented Program 1

    参考:OOP NOTE 1.面向对象编程--Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. ...

  9. 使用一个数组存储一个英文句子"java is an object oriented programing language"

    class fun { public static void main(String[] args) { String str="java is an object oriented pro ...

随机推荐

  1. 表单提交post和get方法区别

    表象不同,get把提交的数据url可以看到,post看不到 原理不同,get 是拼接 url, post 是放入http 请求体中 提交数据量不同,get最多提交2k数据,浏览器的限制.post理论上 ...

  2. C++五种迭代器之间的关系

    迭代器操作                      说明(1)所有迭代器p++                              后置自增迭代器++p                     ...

  3. Struts Spring Plugin注意点

    Settings The following settings can be customized. See the developer guide. Setting Description Defa ...

  4. centos mysql iptables配置

    在CentOS系统中防火墙默认是阻止3306端口的,我们要是想访问mysql数据库,我们需要这个端口,命令如下: iptables -I INPUT -p tcp --dport 3036 -j AC ...

  5. NodeJS 安装不存在的模块

    设置npm镜像: npm config set registry https://registry.npm.taobao.org 我遇到的报错情况: Error: Cannot find module ...

  6. 工作总结 Ajax.BeginForm 默认action

    生成源代码 点提交 总结 BeginForm 的 active 默认指向 进当前页面的 操作方法    若第一次进页面时带着参数, 那么也会将参数放到active 简单点  BeginForm 的 a ...

  7. TensorFlow学习笔记 补充1——InteractiveSession

    InteractiveSession 大家有时候在阅读代码时会看见InteractiveSession而不是熟悉的Session,这是什么东东呢? 其实,它们只有一点不同..... Interacti ...

  8. 高分辨率转HTML成PDF(ephtmltopdf.dll)

    今天看到园友分享的 wkhtmtopdf--高分辨率转HTML成PDF(三) 想起我做 一键保存网页为PDF_V1.2 的时候,也研究过一段时间这个,一开始也看的是wkhtmltopdf,不过发现wk ...

  9. 设计模式中类的关系之聚合关系(Aggregation)

    聚合关系是关联关系的一种特例,它体现的是整体与部分的关系,即has-a的关系,此时整体与部分之间是可分离的,它们可以具有各自的生命周期,部分可以属于多个整体对象,也可以为多个整体对象共享.比如计算机与 ...

  10. php 批量处理post数据

    <?php header("Content-Type:text/html;charset=UTF-8"); include('ini.php'); foreach ($_PO ...