Object-Oriented Metrics: LCOM 内聚性的度量
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 内聚性的度量的更多相关文章
- CSharpGL - Object Oriented OpenGL in C#
Object Oriented OpenGL in C#
- Object Oriented Programming python
Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...
- What is Object Oriented Design? (OOD)
Object Oriented Design is the concept that forces programmers to plan out their code in order to hav ...
- Java - 面向对象(object oriented)计划 详细解释
面向对象(object oriented)计划 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24058107 程序包括 ...
- OO开发思想:面向对象的开发方法(Object oriented,OO)
面向对象的开发方法(Object oriented,OO)认为是好文章吧,拿来分享一下(转载) 面向对象的开发方法(Object oriented,OO) 从事软件开发的工程 师们常常有这样 的体会: ...
- JavaScript: Constructor and Object Oriented Programming
Constructor : Grammar: object.constructor Example: Javascript code: 1 function obj1() { this.number ...
- 面对对象编程(OOP, Object Oriented Programming)及其三个基本特性
一千个读者,一千个哈姆雷特.对于面对对象编程,书上都会告诉我们它有三个基本特性,封装,继承,多态,但谈起对这三点的见解,又是仁者见仁智者见智,感觉还是得多去编程中体验把 . 面向对象编程(OOP, O ...
- Python学习札记(三十) 面向对象编程 Object Oriented Program 1
参考:OOP NOTE 1.面向对象编程--Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. ...
- 使用一个数组存储一个英文句子"java is an object oriented programing language"
class fun { public static void main(String[] args) { String str="java is an object oriented pro ...
随机推荐
- 在github上建立jekyll blog
1.git常用命令(简易介绍见http://rogerdudler.github.io/git-guide/index.zh.html) git init #创建新的git仓库 git clo ...
- 非常酷的 Javascript 简单调试工具Blackbird
Blackbird 是一个开源的 Javascript 调试工具,默认提供一种非常酷的方式展现 Javascript 调试信息,如下图,效果如何呢? 在我们的日常的学习或工作中,经常都会接触到 Jav ...
- C#--I/O流操作文本文件之StreamWrite类和StreamReader类
使用I/O流操作文本文件时主要用到StreamWrite类和StreamRead类. 1.StreamWrite类 (1)StreamWrite类专门用来处理文本文件的类.能够方便地想文本文件里写入字 ...
- 利用Python读取文件名并生成txt文件——以图片文件为例
效果如下: 代码: import os class ReadImageName(): def __init__(self): self.path = '.' def readname(self): f ...
- atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerException v2 q31
atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerExceptionv2 q31 1. #--现象 java.lang. ...
- [ci]项目规划-后续
几个方面来写 1,搭建gitlab 配邮箱 域名等使之好用 2,搭建jenkins –yum,安装常见插件 3,搭建sonar,汉化 4,安装sonar-scanner 0,实现sonar ...
- python学习之pyenv
我们经常有这种需求: linux系统中既要有python2.xxx,又要有python3.xxx,甚至更极端的情况是,有多个版本的python3.xxx. 如何实现上述需求呢?更新python的话,费 ...
- formail 发送HTML 邮件通过 SENDMAIL
cat a.html | formail -I "Content-type:text/html;charset=utf-8" -I "Subject:layer4 con ...
- 2016ATF阿里巴巴技术论坛
转自:http://blog.csdn.net/mini_monster/article/details/51175879 “爱迪生的贡献不在于让灯泡亮的更久一些,爱迪生最大的贡献是在全世界第一个想到 ...
- shell实现倒计时功能
#!/bin/bash ############################################################## # File Name: oldboyedu.sh ...