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. 基于React实现的【绿色版电子书阅读器】,支持离线下载

    代码地址如下:http://www.demodashi.com/demo/12052.html MyReader 绿色版电子书阅读器 在线地址:http://myreader.linxins.com ...

  2. applicationContext.xml 文件头报错Referenced file contains errors

    问题如下:原先运行正常的项目,突然在applicationContext.xml 文件头报错 内容:Referenced file contains errors (http://www.spring ...

  3. WP8滑动条(Slider)控件的使用

    1. <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinit ...

  4. 使用node.js 文档里的方法写一个web服务器

    刚刚看了node.js文档里的一个小例子,就是用 node.js 写一个web服务器的小例子 上代码 (*^▽^*) //helloworld.js// 使用node.js写一个服务器 const h ...

  5. FPGA研发之道(25)-管脚

    管脚是FPGA重要的资源之一,FPGA的管脚分别包括,电源管脚,普通I/O,配置管脚,时钟专用输入管脚GCLK等. 本文引用地址:http://www.eepw.com.cn/article/2664 ...

  6. sigpending

    信号的阻塞:通过sigprocmask()将信号集sigset_t中的信号设置为阻塞.SIG_BLOCK是指对相应信号的“递送阻塞”,内核在递送一个原来被阻塞的信号给进程时(而不是在产生该信号时),才 ...

  7. Tomcat闲聊

    上面是Tomcat的执行过程. 下面说几个概念: 1.JSP:这个就是在html文件中嵌入Java代码之后重新生成的一个文件(.jsp的文件) 2.servlet:就是一个处理动态资源的小程序,一般位 ...

  8. vue 过渡的-css-类名

    会有6个css类名在leave/enter过渡中切换 1,v-enter:定义进入过渡的开始状态,在元素被插入时生效,在下一帧中移除 2,v-enter-active:定义过渡的状态.在元素整个过渡过 ...

  9. HTML5实现端访问时禁止放大和缩小网页

    <title>html5禁止和移动.缩放网页</title><meta name="viewport" content="width=dev ...

  10. jQuery实现3D幻灯片

    先看下效果图: 看到这个酷炫的效果有没有很眼馋啊!接下来我们就一起来学习实现它吧. 1.看到效果后我们先分析这个dom要怎么实现! 首先我们要用一个大容器包裹内容,其次这个看起来像是3d效果的图片实际 ...