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. [Mac A]如何学习Mac编程?

    http://ourcoders.com/thread/show/5550/ @tinyfool 看了您在quora上回答的『为什么说程序员是最好的职业』,加上本来就想学编程(但是一直以来因为各种借口 ...

  2. Oracle undo 表空间管理 (摘DAVID)

    Oracle 的Undo有两种方式: 一是使用undo 表空间,二是使用回滚段. 我们通过 undo_management 参数来控制使用哪种方式,如果设为auto,就使用UNDO 表空间,这时必须要 ...

  3. "《 Serial Drivers 》by Alessandro Rubini" 学习笔记

    Introduction to "serial device driver"     (My study note) 膜拜大神的作品. Standing on the should ...

  4. JaunsGraph数据模型

    JanusGraph采用邻接表(adjacency list)的方式存储图,也即图以顶点(vertex)和其邻接表组成.邻接表中保存某个顶点的所有入射边(incident edges). 通过将图采用 ...

  5. centos 7.x systemctl 几个常用的操作

    # 开机启动 systemctl enable nginx # 禁止开机启动 systemctl disable nginx # 开启服务 systemctl start nginx # 停止服务 s ...

  6. 用户输入URL后发生了什么,以及优化问题

    用户角度:1.打开浏览器2.输入URL3.按下回车4.浏览器呈现画面 当用户输入页面地址后,浏览器获得用户希望访问的地址,便向该站点服务器发起一系列的请求,这些请求不光包括对页面的请求,还包括对页面中 ...

  7. iOS 音频开发

      音频基础知识 组成 音频文件的组成:文件格式(或者音频容器) + 数据格式(或者音频编码). 文件格式(或音频容器)是用于形容文件本身的格式. 我们可以通过多种不同的方法为真正的音频数据编码.例如 ...

  8. Ocelot + IdentityServer4 坑自己

    现像是 connect/userinfo 可以访问 但是api都提示401 后面发现是在appsettings.json "Options": {"Authority&q ...

  9. Who's in the Middle - poj 2388 (快速排序寻找中位数)

    题意; 寻找中位数 利用快速排序来寻找中位数. #include <iostream> using namespace std; int N; ]; int Median(int left ...

  10. Java中String的split()方法的一些疑问和试验

    http://tjuking.iteye.com/blog/1507855 和我想的还是不大一样,因为不知道源码也不知道具体是怎么实现的,我的理解如下: 当字符串只包含分隔符时,返回数组没有元素:当字 ...