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. jQuery 获取DOM节点的两种方式

    jQuery中包裹后的DOM对象实际上是一个数组,要获得纯粹的DOM对象可以有两种方式: 1.使用数组索引方式访问,例如: var dom = $(dom)[0]; 如: $("#id&qu ...

  2. 安装JDK不当--找不到或无法加载主类 com.sun.tools.javac.Main

    问题描述:我的问题是在使用javac编译测试程序市,出现如下错误: 错误: 找不到或无法加载主类 com.sun.tools.javac.Main 解决办法:当出现这个错误时,百度之,结果很多人都是说 ...

  3. Oracle安装过程中的几点注意

    为追求统一,安装了oracle 11g step 4时需要改一下名称,利于记忆 数据库安装完之后需要取消SCOTT账户的锁定 完成后点击SQL Developer会出现——"应用程序开发&q ...

  4. android-gradle-深入浅出-五:build type

    默认情况下,Android插件自动为项目构建一个debug和一个release版本的应用.这两个版本的不同主要体现在在非开发机上的调试功能以及APK的签名方式.debug版本使用一个用公开的name/ ...

  5. Linux在本地使用yum安装软件

    经常遇到有的linux服务器由于特殊原因,不能连接外网,但是经常需要安装一些软件,尤其是在编译一些包的时候经常由于没有安装一些依存包而报的各种各样的错误,当你找到依存的rpm包去安装的时候,又提示你有 ...

  6. CentOS 加载/挂载光驱

    1.mkdir /mnt/cdrom 2.mount /dev/cdrom /mnt/cdrom 3.挂载      umount /dev/cdrom /mnt/cdrom

  7. 字符串函数---strcmp()与strncmp()具体解释及实现

    一.strcmp()与strncmp() strcmp():strcmp(s1,s2);            比較两个字符串.        strncmp():strncmp(s1,s2);   ...

  8. 521. Longest Uncommon Subsequence I【easy】

    521. Longest Uncommon Subsequence I[easy] Given a group of two strings, you need to find the longest ...

  9. collection动画

    Collection View 动画 吴迪 12 May 2014 分享文章 UICollectionView 和相关类的设置非常灵活和强大.但是灵活性一旦增强,某种程度上也增加了其复杂性: UICo ...

  10. openWRT自学---如何开发新的用户态模块-helloworld

    以http://www.gargoyle-router.com/wiki/doku.php?id=openwrt_coding为参考文档 1.要获得openWRT的sdk环境.只要在Backfire的 ...