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 ...
随机推荐
- lodash random
_.random([min=0], [max=1], [floating]) 产生一个包括 min 与 max 之间的数. 如果只提供一个参数返回一个0到提供数之间的数. 如果 floating 设为 ...
- Centos下安装JDK、Maven和Git
原文地址:https://github.com/eacdy/spring-cloud-book/blob/master/3%20%E4%BD%BF%E7%94%A8Docker%E6%9E%84%E5 ...
- WPF开源框架项目
好久博客未更新新博文了,今天介绍一个WPF开源框架MaterialDesignInXamlToolkit废话不多说先让我们来看看框架得几张截图 让我们一起来看看源代码得结构如下图 接下我们运行代码看看 ...
- Rabbitmq消息队列(二) Hello World! 模拟简单发送接收
1.简介 RabbitMQ是消息代理:它接受和转发消息.你可以把它当作一个邮局:当你把你要邮寄的邮件放在信箱里时,你可以肯定Postman先生最终会把邮件送到你的收件人那里.在这个比喻中,Rabbit ...
- POJ 2528 Mayor's posters 离散化+线段树
题目大意:给出一些海报和贴在墙上的区间.问这些海报依照顺序贴完之后,最后能后看到多少种海报. 思路:区间的范围太大,然而最多仅仅会有10000张海报,所以要离散化. 之后用线段树随便搞搞就能过. 关键 ...
- c++ about SLL(Static-Link Library) and DLL(Dynamic-Link Library)
First thing first, Wiki: http://en.wikipedia.org/wiki/Dynamic-link_library http://en.wikipedia.org/w ...
- Windows手动安装MySQL
由于MySQL 5.6(也许5.5)以后去掉了Server Instance Configuration Wizard(服务实例配置向导),于是msi版变成了和zip版一样,要手动配置. * 假定安装 ...
- 指尖上的电商---(11)Windows平台部署SolrCloud
SolrCloud是一种分布式解决方式,是基于zookeeper和solr的,能够简单理解为一种集群,能够提供分布式查询.分布式写索引. SolrCloud的结构大致是这种,一个SolrCloud包含 ...
- Unity Tiling和offset的使用
offset是显示框的偏移量 1)拿flappy bird素材来说,起始状态是这种↓. 注意显示框(黄色).它包含的范围是这种↓ 2)当offset_x设置为0.5的时候,显示框(黄色)包含的范围应该 ...
- html+css+JavaScript贪吃蛇
写文记录一下最近新完成的贪吃蛇游戏案例,用到了html.css和JavaScript,难度不高,适合刚入坑的同学练习,欢迎大家交流. 下面贴源码: <!DOCTYPE html> < ...