SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
International Journal of Computational Engineering Research||Vol, 03||Issue, 6||
www.ijceronline.com ||June ||2013|| Page 8
An Effort to Improve Cohesion Metrics Using Inheritance
Ankita Mann1
, Sandeep Dalal2
,Dhreej Chhillar3
1,2,3,
Department of Computer Science and Applications M.D. University Rohtak, Haryana, India
I. INTRODUCTION
Concept of Software cohesion was started in 1970’s by Stevens et al. [7] who wants inter module
metrics for procedural Software’s. Software cohesion is a measure of degree to which elements of a module
belong together and measured at class level and it is most important Object Oriented Software attribute.
1.1. Types of cohesions:
Method Cohesion: Method is a module or bracketed piece of code that implement some functionality. Method
cohesion focuses on the methods you write inside the class. Classical cohesion adapts seven degree of cohesion
summarized from worst to best:
Coincidental Cohesion Worst Cohesion
Best Cohesion
Logical Cohesion
Temporal Cohesion
Procedural Cohesion
Communicational Cohesion
Sequential Cohesion
Functional Cohesion
Table 2: Classification Classical Cohesion
1.2.Class Cohesion: Classes are the fundamental units of object-oriented programs, and provided as the units of
encapsulation promoting their modifiability and reusability. Class cohesion measure quality of classes by
measuring binding of the elements defined with in the class. Inherited instance variables and inherited methods
are not considered. Member methods are elements of a class and perform a common task and allow you to
systematize class reasonably. Cohesiveness of a class depends upon its representation of its object as single,
meaningful data abstraction. Cohesion of a class is rated as separable if its objects signify various unconnected
data abstractions combined in one ne object. In this case instance variables and methods of class are partitioned
into sets such that no method of one set uses instance variable or invoke method of a different set. For example
if you have ten methods that act as utilities for network operations, you can very well split the class into two
classes: one serving the utilities and the other, network operations. After split each separated class represent
single data abstraction.
II. MAJOR EXISTING COHESION METRICS
Classes are basic units of Object oriented Software and should be designed to have good quality.
Improper modeling produce improper responsibilities and assignment and result will be low cohesion. In order
to assess class cohesion in object oriented systems we have several metrics. Cohesion Metrics measure
togetherness of method of a class. A highly cohesive class performs one function. Most of the Cohesion Metrics
ABSTRACT
Software metrics are used to assess and improve the quality of Software Product. Class
Cohesion is degree of relatedness of class members and important measurement attribute of quality of a
software product. But most of the existing cohesion tools and approaches do not consider inherited
elements. But to measure overall design of product it is necessary to include all inherited elements. In
this paper we calculate all existing metrics on implemented elements as well as on inherited elements to
measure quality of design.
KEYWORDS: Software metrics, Cohesion.
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 9
are based on LCOM (lack of cohesion in methods) metrics defined by Chidamber and Kemerer[Chidamber 91]
and it is also refined by many others. The Chidamber & Kemerer metrics suite originally consists of 6 metrics
for each class: WMC, DIT, NOC, CBO, RFC and LCOM1. Suite has later been amended by RFC´, LCOM2,
LCOM3 and LCOM4 by other authors.
 LCOM1: LCOM1 was introduced in Chidamber & Kemerer metrics suite. This metric calculate the
number of pairs of methods in class using no instance variable in common.
LCOM1 = P – Q, if value of result is positive. LCOM1 = 0 if value of subtraction is negative.
0 indicates that class is cohesive and LCOM1 > 0, indicates that the class needs or can be split into two or more
classes.
 LCOM2:P is Number of pairs of methods that do not share attributes and Q = Number of pairs of methods
that share attributes.
LCOM2=P-Q if P-Q>0 and otherwise LCOM2=0
 LCOM3: =LCOM3 is proposed by Li & Henry, 1993 and calculated by number of disjoint components in
the graph that represents each method as a node and the sharing of at least one attribute as an edge.
 LCOM4: LCOM4 measures the number of "connected components" in a class. A connected component is
a set of related methods (and class-level variables).
LCOM4=1 indicates a cohesive class, which is the "good" class.
LCOM4>=2 indicates a problem. The class should be split into so many smaller classes.
LCOM4=0 happens when there are no methods in a class. This is also a "bad" class.
 LCOM5: LCOM5 is purposed by Henderson-Sellers.
LCOM5 = (a – kℓ) / (ℓ – kℓ),
ℓ => number of attributes,
k=> number of methods,
a => summation of the number of distinct attributes accessed by each method in a class.
 Coh: Coh is variation in LCOM5.
Coh = a / kℓ or Coh = 1 – (1 – 1/k)LCOM5
 TCC (Tight Class Cohesion): TCC is defined as the percentage of method pairs that are directly related.
Consider a class with n public methods. Let NP be the maximum number of public method pairs:
NP = maximum number of possible connections= N * (N-1) / 2 where N is the number of methods
NDC = number of direct connections (number of edges in the connection graph)
Tight class cohesion TCC = NDC/NP
 LCC (Loose Class Cohesion): LCC is defined as the relative number of indirectly connected public
methods. NIC is number of direct or indirect connections between public methods.
NID = number of indirect connections.
LCC= NIC/ NP
III. INHERITANCE AND COHESION
Inheritance is a key concept in object-oriented programming and implementing the inheritance relations
in a software system properly is expected to improve the quality of the system. [12] But most of the existing
metrics tools do not consider inherited methods. But design of full project depends upon both inherited as well
as implemented methods. To measure overall design complexity both study of both elements is required.
Therefore there is need to examine cohesion with or without inherited elements.
Fig. 1: Procedure Followed in this paper
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 10
Three Cases discussed in this paper are:
Case1:
Using System;
Class Base
{
Protected int Volume;
Public out()
{
Console.writeline(“this is base class”);
}
}
Class Sub: Base
{
Public Conevol()
{
Float Radius, Height;
Console.writeLine(“enter radius of cube”);
Radius= Console.readLine;
Console.writeLine(“enter height of cube”);
Height= Console.readLine;
Volume=1/3*22/7*Radius*Radius*Height;
}
Public Cylindervol()
{
Float Radius, Height;
Console.writeLine(“enter radius of cylinder”);
Radius= Console.readLine;
Console.writeLine(“enter height of cylinder”);
Height= Console.readLine;
Volume=22/7*Radius*Height;
}
Public Prismvol()
{
Float Width, Height, Lenght;
Console.writeLine(“enter width of prism”);
Width= Console.readLine;
Console.writeLine(“enter height of prism”);
Height= Console.readLine;
Console.writeLine(“enter length of prism”);
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 11
Length= Console.readLine;
Volume= Length*Width*Height;
}
}
Class mainclass
{
Public static void Main()
{
Sub sub=new Sub();
sub. out();
sub. Conevol();
sub. Prismvol();
}
}
Fig. 2: Diagrammatic representation for Case1
In this example Cone, Prism and Cylinder are implemented elements of sub class that share a common
attribute Volume that is element of super class here cohesion is low if only implemented elements are
considered because there is no connection between implanted methods if we exclude inherited elements. Out is
method of super class and there is no link of out with any other implemented or inherited element. Values of
TCC and LCC are zero if we exclude inherited elements.
Implemented
Elements
Inherited
Elements
Metrics
3 3 LCOM1
3 0 LCOM2
3 2 LCOM3
3 2 LCOM4
0 1/3 LCOM5
1 7/9 Coh
0 ½ TCC
0 2/6 LCC
Table 4: Result for Cohesion metrics including and excluding inherited elements
Case2:
Using System;
Class Base
{
int Area;
protected square()
{
int side;
Console.writeLine(“enter side of square”);
Cone Prism
Cylinder
Volume
Out
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 12
side= Console.readLine;
Area= side*side;
Console.writeLine(“Area of square is=”Area);
}
protected rectangle()
{
int length, breath;
Console.writeLine(“enter sides of rectangle”);
lenght= Console.readLine;
breath = Console.readLine;
Area= lenght*breath;
Console.writeLine(“Area of rectangle is=”Area);
}
}
Class Sub: base
{
Public method1()
{
Console.writeLine(“subclass method1”);
}
Public method2()
{
Console.writeLine(“subclass method2”);
}
}
Class test
{
Public static void main()
{
Sub sub= new sub();
sub.square();
sub.method1();
sub.method2();
}}
Fig. 3: Diagrammatic Representation for Case2
In this program Method1 and Method2 are implemented method in sub class and rectangle and square are
method of inherited class that shares a common super class variable Area. In this example cohesion of sub class
elements is almost zero So if we include inherited elements in calculating cohesion of this code results are
better.
Implemented
Elements
Inherited
Elements
Metrics
1 5 LCOM1
1 4 LCOM2
2 3 LCOM3
2 3 LCOM4
0 2/3 LCOM5
1 ½ Coh
0 1/6 TCC
0 1/6 LCC
Table 5: Result for Cohesion metrics including and excluding inherited elements
Method1 Method2
Rectangle
SquareArea
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 13
Case3:
using System;
namespace InheritanceApplication
{
class Shape
{
protected int width;
public void setWidth()
{
width = w;
}
Class Rectangle: Shape
{
protected int height;
public void setHeight(int h)
{
Height= h;
}
Public area()
{
Return (width * height);
}
Public volume()
{
Return (1/2(width + height));
}
}
class RectangleTester
{
Public static void Main()
{
Rectangle Rect = new Rectangle();
Rect.setWidth(5);
Rect.setHeight(7);
Console.WriteLine("Total area: {0}", Rect.Area());
Console.WriteLine("Total area: {0}", Rect.volume());
}
Fig. 4 Diagrammatic Representation for Case3
In this case Area, Volume, Setheight and height are implemented elements. Width and Set width are elements
defined in base class. Design of this program is better than other cases. Cohesion of this program is good in both
cases but value of LCC indicates design quality of this program.
Implemented
Elements
Inherited Elements Metrics
0 1 LCOM1
0 0 LCOM2
1 1 LCOM3
1 1 LCOM4
0 0.333 LCOM5
1 0.75 Coh
1 0.8333 TCC
0.666 1 LCC
Area SetHeightVolume
Height
SetWidth
Width
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 14
Table 5: Result for Cohesion metrics including and excluding inherited elements
CASE1:
Fig.5: Graphical representation of results of Case1
CASE2:
Fig.6: Graphical representation of results of Case2
CASE3:
Fig. 7: Graphical representation of results of Case3
IV. CONCLUSION AND FUTURE WORK
By including inherited elements cohesion can be increased or decreased depending upon design
structure of super class and sub class. Additional efforts are requires to measure design complexity by including
inherited elements. TCC and LCC are used to measure design complexity of software.
An Effort To Improve Cohesion Metrics…
www.ijceronline.com ||June ||2013|| Page 15
This study will help to improve the applicability of existing cohesion metrics to measure the
requirement of refactoring the classes. LCC helps to assess reusability of code. There are some aspects related to
inheritance that are not discussed in this paper for example: Concept of public, private, protected and internal
elements require investigation. Concept of direct or indirect call by instance variable should be considered.
REFERENCES
[1] Improving Applicability of Cohesion Metrics Including Inheritance”, Jaspreet Kaur, Rupinder Kaur, International Journal of
Application or Innovation in Engineering & Management (IJAIEM)
[2] Empirical Study of Object-Oriented Metrics”, K.K.Aggarwal, Yogesh Singh, Arvinder Kaur, Ruchika Malhotra, JOURNAL
OF OBJECT TECHNOLOGY
[3] Observations on Lack of Cohesion Metrics”, Sami Mäkelä and Ville Leppänen, International Conference on Computer
Systems and Technologies - CompSysTech’06
[4] Comparison of Various Lacks of Cohesion Metrics”, Taranjeet Kaur, Rupinder Kaur, International Journal of Engineering and
Advanced Technology (IJEAT)
[5] A Proposal for Normalized Lack of Cohesion in Method (LCOM) Metric Using Field Experiment”, Ezekiel Okike, IJCSI
International Journal of Computer Science Issues, Vol. 7, Issue 4, No 5, July 2010
[6] An Object-Oriented High-Level Design-Based Class Cohesion Metric”, Jehad Al Dallal,
[7] Using Object-Oriented Metrics for Automatic Design Flaws Detection in Large Scale Systems”, Dipl.-Ing. Radu Marinescu
[8] Mathematical Validation of Object-Oriented Class Cohesion Metrics”, Jehad Al Dallal, INTERNATIONAL JOURNAL OF
COMPUTERS Issue 2, Volume 4, 2010
[9] Modeling Class Cohesion as Mixtures of Latent Topics”
[10] Design ACM TOSEM, April 2006 Steve Counsell, Stephen Swift, and Jason”
[11] http://www.aivosto.com/project/help/pm-oo-cohesion.html
[12] The Impact of Inheritance on the Internal Quality Attributes of Java Classes”, Jehad Al Dallal Department of Information
Science- Kuwait University
[13] Identification of nominated classes for software refactoring using Object –Oriented Cohesion metrics”, Safwat M. Ibrahim,
Sameh A. Aalem, Manal A. Ismail and Mohamed Eladawy
[14] Complexity Identification of Inheritance and Interface based on Cohesion and Coupling Metrics to Increase Reusability”,
Maya Yadav, Jasvinder Pal Singh, Pradeep Baniya, International Journal of Computer Applications (0975 – 8887)

Mais conteúdo relacionado

Mais procurados

IRJET- Semantics based Document Clustering
IRJET- Semantics based Document ClusteringIRJET- Semantics based Document Clustering
IRJET- Semantics based Document ClusteringIRJET Journal
 
Parallel and distributed genetic algorithm with multiple objectives to impro...
Parallel and distributed genetic algorithm  with multiple objectives to impro...Parallel and distributed genetic algorithm  with multiple objectives to impro...
Parallel and distributed genetic algorithm with multiple objectives to impro...khalil IBRAHIM
 
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...iosrjce
 
Finding important nodes in social networks based on modified pagerank
Finding important nodes in social networks based on modified pagerankFinding important nodes in social networks based on modified pagerank
Finding important nodes in social networks based on modified pagerankcsandit
 
Interior Dual Optimization Software Engineering with Applications in BCS Elec...
Interior Dual Optimization Software Engineering with Applications in BCS Elec...Interior Dual Optimization Software Engineering with Applications in BCS Elec...
Interior Dual Optimization Software Engineering with Applications in BCS Elec...BRNSS Publication Hub
 
Study on Some Key Issues of Synergetic Neural Network
Study on Some Key Issues of Synergetic Neural Network  Study on Some Key Issues of Synergetic Neural Network
Study on Some Key Issues of Synergetic Neural Network Jie Bao
 
Measurement Metrics for Object Oriented Design
Measurement Metrics for Object Oriented DesignMeasurement Metrics for Object Oriented Design
Measurement Metrics for Object Oriented Designzebew
 
IRJET- Semantic Analysis of Online Customer Queries
IRJET-  	  Semantic Analysis of Online Customer QueriesIRJET-  	  Semantic Analysis of Online Customer Queries
IRJET- Semantic Analysis of Online Customer QueriesIRJET Journal
 
Migration strategies for object oriented system to component based system
Migration strategies for object oriented system to component based systemMigration strategies for object oriented system to component based system
Migration strategies for object oriented system to component based systemijfcstjournal
 
Possibility of interdisciplinary research software engineering andnatural lan...
Possibility of interdisciplinary research software engineering andnatural lan...Possibility of interdisciplinary research software engineering andnatural lan...
Possibility of interdisciplinary research software engineering andnatural lan...Nakul Sharma
 
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...A sensitivity analysis of contribution-based cooperative co-evolutionary algo...
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...Borhan Kazimipour
 
352735350 rsh-qam11-tif-15-doc
352735350 rsh-qam11-tif-15-doc352735350 rsh-qam11-tif-15-doc
352735350 rsh-qam11-tif-15-docFiras Husseini
 
Leader election approach a comparison and survey
Leader election approach a comparison and surveyLeader election approach a comparison and survey
Leader election approach a comparison and surveyEditor Jacotech
 
Subjective evaluation answer ppt
Subjective evaluation answer pptSubjective evaluation answer ppt
Subjective evaluation answer pptMrunal Pagnis
 
KnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectKnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectMarciano Moreno
 

Mais procurados (18)

IRJET- Semantics based Document Clustering
IRJET- Semantics based Document ClusteringIRJET- Semantics based Document Clustering
IRJET- Semantics based Document Clustering
 
Parallel and distributed genetic algorithm with multiple objectives to impro...
Parallel and distributed genetic algorithm  with multiple objectives to impro...Parallel and distributed genetic algorithm  with multiple objectives to impro...
Parallel and distributed genetic algorithm with multiple objectives to impro...
 
Topic modeling
Topic modelingTopic modeling
Topic modeling
 
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
 
C04701019027
C04701019027C04701019027
C04701019027
 
TO_EDIT
TO_EDITTO_EDIT
TO_EDIT
 
Finding important nodes in social networks based on modified pagerank
Finding important nodes in social networks based on modified pagerankFinding important nodes in social networks based on modified pagerank
Finding important nodes in social networks based on modified pagerank
 
Interior Dual Optimization Software Engineering with Applications in BCS Elec...
Interior Dual Optimization Software Engineering with Applications in BCS Elec...Interior Dual Optimization Software Engineering with Applications in BCS Elec...
Interior Dual Optimization Software Engineering with Applications in BCS Elec...
 
Study on Some Key Issues of Synergetic Neural Network
Study on Some Key Issues of Synergetic Neural Network  Study on Some Key Issues of Synergetic Neural Network
Study on Some Key Issues of Synergetic Neural Network
 
Measurement Metrics for Object Oriented Design
Measurement Metrics for Object Oriented DesignMeasurement Metrics for Object Oriented Design
Measurement Metrics for Object Oriented Design
 
IRJET- Semantic Analysis of Online Customer Queries
IRJET-  	  Semantic Analysis of Online Customer QueriesIRJET-  	  Semantic Analysis of Online Customer Queries
IRJET- Semantic Analysis of Online Customer Queries
 
Migration strategies for object oriented system to component based system
Migration strategies for object oriented system to component based systemMigration strategies for object oriented system to component based system
Migration strategies for object oriented system to component based system
 
Possibility of interdisciplinary research software engineering andnatural lan...
Possibility of interdisciplinary research software engineering andnatural lan...Possibility of interdisciplinary research software engineering andnatural lan...
Possibility of interdisciplinary research software engineering andnatural lan...
 
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...A sensitivity analysis of contribution-based cooperative co-evolutionary algo...
A sensitivity analysis of contribution-based cooperative co-evolutionary algo...
 
352735350 rsh-qam11-tif-15-doc
352735350 rsh-qam11-tif-15-doc352735350 rsh-qam11-tif-15-doc
352735350 rsh-qam11-tif-15-doc
 
Leader election approach a comparison and survey
Leader election approach a comparison and surveyLeader election approach a comparison and survey
Leader election approach a comparison and survey
 
Subjective evaluation answer ppt
Subjective evaluation answer pptSubjective evaluation answer ppt
Subjective evaluation answer ppt
 
KnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectKnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProject
 

Destaque

Opening and managing a bank account
Opening and managing a bank accountOpening and managing a bank account
Opening and managing a bank accountvshackley
 
Question 4 p1 compressed
Question 4 p1 compressedQuestion 4 p1 compressed
Question 4 p1 compressedclattwood
 
Tecnologia E Informatica Segundo Periodo
Tecnologia E Informatica   Segundo PeriodoTecnologia E Informatica   Segundo Periodo
Tecnologia E Informatica Segundo Periodojulian vega
 
Outsmarting SmartPhones
Outsmarting SmartPhonesOutsmarting SmartPhones
Outsmarting SmartPhonessaurabhharit
 
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent Endeavor...
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent 	 Endeavor...Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent 	 Endeavor...
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent Endeavor...MedicineAndFamily
 
Oscar
OscarOscar
Oscarobema
 

Destaque (8)

Opening and managing a bank account
Opening and managing a bank accountOpening and managing a bank account
Opening and managing a bank account
 
Question 4 p1 compressed
Question 4 p1 compressedQuestion 4 p1 compressed
Question 4 p1 compressed
 
2 1
2 12 1
2 1
 
Tecnologia E Informatica Segundo Periodo
Tecnologia E Informatica   Segundo PeriodoTecnologia E Informatica   Segundo Periodo
Tecnologia E Informatica Segundo Periodo
 
Outsmarting SmartPhones
Outsmarting SmartPhonesOutsmarting SmartPhones
Outsmarting SmartPhones
 
Video 1 circulatory system
Video 1   circulatory systemVideo 1   circulatory system
Video 1 circulatory system
 
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent Endeavor...
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent 	 Endeavor...Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent 	 Endeavor...
Endeavor IV-A Randomized Comparison of a Zotarolimus-Eluting Stent Endeavor...
 
Oscar
OscarOscar
Oscar
 

Semelhante a Improving software cohesion metrics using inheritance

Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...
Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...
Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...IJECEIAES
 
Algorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxAlgorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxdaniahendric
 
Density Based Clustering Approach for Solving the Software Component Restruct...
Density Based Clustering Approach for Solving the Software Component Restruct...Density Based Clustering Approach for Solving the Software Component Restruct...
Density Based Clustering Approach for Solving the Software Component Restruct...IRJET Journal
 
Fuzzy Rule Base System for Software Classification
Fuzzy Rule Base System for Software ClassificationFuzzy Rule Base System for Software Classification
Fuzzy Rule Base System for Software Classificationijcsit
 
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...ijseajournal
 
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTION
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTIONGRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTION
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTIONIJCSEA Journal
 
ANP-GP Approach for Selection of Software Architecture Styles
ANP-GP Approach for Selection of Software Architecture StylesANP-GP Approach for Selection of Software Architecture Styles
ANP-GP Approach for Selection of Software Architecture StylesWaqas Tariq
 
SIZE ESTIMATION OF OLAP SYSTEMS
SIZE ESTIMATION OF OLAP SYSTEMSSIZE ESTIMATION OF OLAP SYSTEMS
SIZE ESTIMATION OF OLAP SYSTEMScscpconf
 
Size estimation of olap systems
Size estimation of olap systemsSize estimation of olap systems
Size estimation of olap systemscsandit
 
Threshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesThreshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesjournalBEEI
 
Estimating project development effort using clustered regression approach
Estimating project development effort using clustered regression approachEstimating project development effort using clustered regression approach
Estimating project development effort using clustered regression approachcsandit
 
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACH
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACHESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACH
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACHcscpconf
 
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITY
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITYA STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITY
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITYcscpconf
 
Iso9126 based software quality evaluation using choquet integral
Iso9126 based software quality evaluation using choquet integral Iso9126 based software quality evaluation using choquet integral
Iso9126 based software quality evaluation using choquet integral ijseajournal
 
Online eaxmination
Online eaxminationOnline eaxmination
Online eaxminationAditi_17
 
Cs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dceCs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dcetagoreengineering
 
Student Selection Based On Academic Achievement System using k-mean Algorithm
Student Selection Based On Academic Achievement System using k-mean AlgorithmStudent Selection Based On Academic Achievement System using k-mean Algorithm
Student Selection Based On Academic Achievement System using k-mean AlgorithmNik Ridhuan
 
Software engg. pressman_ch-11
Software engg. pressman_ch-11Software engg. pressman_ch-11
Software engg. pressman_ch-11Dhairya Joshi
 

Semelhante a Improving software cohesion metrics using inheritance (20)

Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...
Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...
Identifying Thresholds for Distance Design-based Direct Class Cohesion (D3C2)...
 
Algorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxAlgorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docx
 
Density Based Clustering Approach for Solving the Software Component Restruct...
Density Based Clustering Approach for Solving the Software Component Restruct...Density Based Clustering Approach for Solving the Software Component Restruct...
Density Based Clustering Approach for Solving the Software Component Restruct...
 
Fuzzy Rule Base System for Software Classification
Fuzzy Rule Base System for Software ClassificationFuzzy Rule Base System for Software Classification
Fuzzy Rule Base System for Software Classification
 
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
 
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTION
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTIONGRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTION
GRID COMPUTING: STRATEGIC DECISION MAKING IN RESOURCE SELECTION
 
ANP-GP Approach for Selection of Software Architecture Styles
ANP-GP Approach for Selection of Software Architecture StylesANP-GP Approach for Selection of Software Architecture Styles
ANP-GP Approach for Selection of Software Architecture Styles
 
SIZE ESTIMATION OF OLAP SYSTEMS
SIZE ESTIMATION OF OLAP SYSTEMSSIZE ESTIMATION OF OLAP SYSTEMS
SIZE ESTIMATION OF OLAP SYSTEMS
 
Size estimation of olap systems
Size estimation of olap systemsSize estimation of olap systems
Size estimation of olap systems
 
Threshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesThreshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniques
 
Estimating project development effort using clustered regression approach
Estimating project development effort using clustered regression approachEstimating project development effort using clustered regression approach
Estimating project development effort using clustered regression approach
 
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACH
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACHESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACH
ESTIMATING PROJECT DEVELOPMENT EFFORT USING CLUSTERED REGRESSION APPROACH
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITY
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITYA STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITY
A STRUCTURAL APPROACH TO IMPROVE SOFTWARE DESIGN REUSABILITY
 
Iso9126 based software quality evaluation using choquet integral
Iso9126 based software quality evaluation using choquet integral Iso9126 based software quality evaluation using choquet integral
Iso9126 based software quality evaluation using choquet integral
 
Online eaxmination
Online eaxminationOnline eaxmination
Online eaxmination
 
Cs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dceCs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dce
 
SE UNIT-3.pdf
SE UNIT-3.pdfSE UNIT-3.pdf
SE UNIT-3.pdf
 
Student Selection Based On Academic Achievement System using k-mean Algorithm
Student Selection Based On Academic Achievement System using k-mean AlgorithmStudent Selection Based On Academic Achievement System using k-mean Algorithm
Student Selection Based On Academic Achievement System using k-mean Algorithm
 
Software engg. pressman_ch-11
Software engg. pressman_ch-11Software engg. pressman_ch-11
Software engg. pressman_ch-11
 

Último

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Improving software cohesion metrics using inheritance

  • 1. International Journal of Computational Engineering Research||Vol, 03||Issue, 6|| www.ijceronline.com ||June ||2013|| Page 8 An Effort to Improve Cohesion Metrics Using Inheritance Ankita Mann1 , Sandeep Dalal2 ,Dhreej Chhillar3 1,2,3, Department of Computer Science and Applications M.D. University Rohtak, Haryana, India I. INTRODUCTION Concept of Software cohesion was started in 1970’s by Stevens et al. [7] who wants inter module metrics for procedural Software’s. Software cohesion is a measure of degree to which elements of a module belong together and measured at class level and it is most important Object Oriented Software attribute. 1.1. Types of cohesions: Method Cohesion: Method is a module or bracketed piece of code that implement some functionality. Method cohesion focuses on the methods you write inside the class. Classical cohesion adapts seven degree of cohesion summarized from worst to best: Coincidental Cohesion Worst Cohesion Best Cohesion Logical Cohesion Temporal Cohesion Procedural Cohesion Communicational Cohesion Sequential Cohesion Functional Cohesion Table 2: Classification Classical Cohesion 1.2.Class Cohesion: Classes are the fundamental units of object-oriented programs, and provided as the units of encapsulation promoting their modifiability and reusability. Class cohesion measure quality of classes by measuring binding of the elements defined with in the class. Inherited instance variables and inherited methods are not considered. Member methods are elements of a class and perform a common task and allow you to systematize class reasonably. Cohesiveness of a class depends upon its representation of its object as single, meaningful data abstraction. Cohesion of a class is rated as separable if its objects signify various unconnected data abstractions combined in one ne object. In this case instance variables and methods of class are partitioned into sets such that no method of one set uses instance variable or invoke method of a different set. For example if you have ten methods that act as utilities for network operations, you can very well split the class into two classes: one serving the utilities and the other, network operations. After split each separated class represent single data abstraction. II. MAJOR EXISTING COHESION METRICS Classes are basic units of Object oriented Software and should be designed to have good quality. Improper modeling produce improper responsibilities and assignment and result will be low cohesion. In order to assess class cohesion in object oriented systems we have several metrics. Cohesion Metrics measure togetherness of method of a class. A highly cohesive class performs one function. Most of the Cohesion Metrics ABSTRACT Software metrics are used to assess and improve the quality of Software Product. Class Cohesion is degree of relatedness of class members and important measurement attribute of quality of a software product. But most of the existing cohesion tools and approaches do not consider inherited elements. But to measure overall design of product it is necessary to include all inherited elements. In this paper we calculate all existing metrics on implemented elements as well as on inherited elements to measure quality of design. KEYWORDS: Software metrics, Cohesion.
  • 2. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 9 are based on LCOM (lack of cohesion in methods) metrics defined by Chidamber and Kemerer[Chidamber 91] and it is also refined by many others. The Chidamber & Kemerer metrics suite originally consists of 6 metrics for each class: WMC, DIT, NOC, CBO, RFC and LCOM1. Suite has later been amended by RFC´, LCOM2, LCOM3 and LCOM4 by other authors.  LCOM1: LCOM1 was introduced in Chidamber & Kemerer metrics suite. This metric calculate the number of pairs of methods in class using no instance variable in common. LCOM1 = P – Q, if value of result is positive. LCOM1 = 0 if value of subtraction is negative. 0 indicates that class is cohesive and LCOM1 > 0, indicates that the class needs or can be split into two or more classes.  LCOM2:P is Number of pairs of methods that do not share attributes and Q = Number of pairs of methods that share attributes. LCOM2=P-Q if P-Q>0 and otherwise LCOM2=0  LCOM3: =LCOM3 is proposed by Li & Henry, 1993 and calculated by number of disjoint components in the graph that represents each method as a node and the sharing of at least one attribute as an edge.  LCOM4: LCOM4 measures the number of "connected components" in a class. A connected component is a set of related methods (and class-level variables). LCOM4=1 indicates a cohesive class, which is the "good" class. LCOM4>=2 indicates a problem. The class should be split into so many smaller classes. LCOM4=0 happens when there are no methods in a class. This is also a "bad" class.  LCOM5: LCOM5 is purposed by Henderson-Sellers. LCOM5 = (a – kℓ) / (ℓ – kℓ), ℓ => number of attributes, k=> number of methods, a => summation of the number of distinct attributes accessed by each method in a class.  Coh: Coh is variation in LCOM5. Coh = a / kℓ or Coh = 1 – (1 – 1/k)LCOM5  TCC (Tight Class Cohesion): TCC is defined as the percentage of method pairs that are directly related. Consider a class with n public methods. Let NP be the maximum number of public method pairs: NP = maximum number of possible connections= N * (N-1) / 2 where N is the number of methods NDC = number of direct connections (number of edges in the connection graph) Tight class cohesion TCC = NDC/NP  LCC (Loose Class Cohesion): LCC is defined as the relative number of indirectly connected public methods. NIC is number of direct or indirect connections between public methods. NID = number of indirect connections. LCC= NIC/ NP III. INHERITANCE AND COHESION Inheritance is a key concept in object-oriented programming and implementing the inheritance relations in a software system properly is expected to improve the quality of the system. [12] But most of the existing metrics tools do not consider inherited methods. But design of full project depends upon both inherited as well as implemented methods. To measure overall design complexity both study of both elements is required. Therefore there is need to examine cohesion with or without inherited elements. Fig. 1: Procedure Followed in this paper
  • 3. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 10 Three Cases discussed in this paper are: Case1: Using System; Class Base { Protected int Volume; Public out() { Console.writeline(“this is base class”); } } Class Sub: Base { Public Conevol() { Float Radius, Height; Console.writeLine(“enter radius of cube”); Radius= Console.readLine; Console.writeLine(“enter height of cube”); Height= Console.readLine; Volume=1/3*22/7*Radius*Radius*Height; } Public Cylindervol() { Float Radius, Height; Console.writeLine(“enter radius of cylinder”); Radius= Console.readLine; Console.writeLine(“enter height of cylinder”); Height= Console.readLine; Volume=22/7*Radius*Height; } Public Prismvol() { Float Width, Height, Lenght; Console.writeLine(“enter width of prism”); Width= Console.readLine; Console.writeLine(“enter height of prism”); Height= Console.readLine; Console.writeLine(“enter length of prism”);
  • 4. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 11 Length= Console.readLine; Volume= Length*Width*Height; } } Class mainclass { Public static void Main() { Sub sub=new Sub(); sub. out(); sub. Conevol(); sub. Prismvol(); } } Fig. 2: Diagrammatic representation for Case1 In this example Cone, Prism and Cylinder are implemented elements of sub class that share a common attribute Volume that is element of super class here cohesion is low if only implemented elements are considered because there is no connection between implanted methods if we exclude inherited elements. Out is method of super class and there is no link of out with any other implemented or inherited element. Values of TCC and LCC are zero if we exclude inherited elements. Implemented Elements Inherited Elements Metrics 3 3 LCOM1 3 0 LCOM2 3 2 LCOM3 3 2 LCOM4 0 1/3 LCOM5 1 7/9 Coh 0 ½ TCC 0 2/6 LCC Table 4: Result for Cohesion metrics including and excluding inherited elements Case2: Using System; Class Base { int Area; protected square() { int side; Console.writeLine(“enter side of square”); Cone Prism Cylinder Volume Out
  • 5. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 12 side= Console.readLine; Area= side*side; Console.writeLine(“Area of square is=”Area); } protected rectangle() { int length, breath; Console.writeLine(“enter sides of rectangle”); lenght= Console.readLine; breath = Console.readLine; Area= lenght*breath; Console.writeLine(“Area of rectangle is=”Area); } } Class Sub: base { Public method1() { Console.writeLine(“subclass method1”); } Public method2() { Console.writeLine(“subclass method2”); } } Class test { Public static void main() { Sub sub= new sub(); sub.square(); sub.method1(); sub.method2(); }} Fig. 3: Diagrammatic Representation for Case2 In this program Method1 and Method2 are implemented method in sub class and rectangle and square are method of inherited class that shares a common super class variable Area. In this example cohesion of sub class elements is almost zero So if we include inherited elements in calculating cohesion of this code results are better. Implemented Elements Inherited Elements Metrics 1 5 LCOM1 1 4 LCOM2 2 3 LCOM3 2 3 LCOM4 0 2/3 LCOM5 1 ½ Coh 0 1/6 TCC 0 1/6 LCC Table 5: Result for Cohesion metrics including and excluding inherited elements Method1 Method2 Rectangle SquareArea
  • 6. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 13 Case3: using System; namespace InheritanceApplication { class Shape { protected int width; public void setWidth() { width = w; } Class Rectangle: Shape { protected int height; public void setHeight(int h) { Height= h; } Public area() { Return (width * height); } Public volume() { Return (1/2(width + height)); } } class RectangleTester { Public static void Main() { Rectangle Rect = new Rectangle(); Rect.setWidth(5); Rect.setHeight(7); Console.WriteLine("Total area: {0}", Rect.Area()); Console.WriteLine("Total area: {0}", Rect.volume()); } Fig. 4 Diagrammatic Representation for Case3 In this case Area, Volume, Setheight and height are implemented elements. Width and Set width are elements defined in base class. Design of this program is better than other cases. Cohesion of this program is good in both cases but value of LCC indicates design quality of this program. Implemented Elements Inherited Elements Metrics 0 1 LCOM1 0 0 LCOM2 1 1 LCOM3 1 1 LCOM4 0 0.333 LCOM5 1 0.75 Coh 1 0.8333 TCC 0.666 1 LCC Area SetHeightVolume Height SetWidth Width
  • 7. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 14 Table 5: Result for Cohesion metrics including and excluding inherited elements CASE1: Fig.5: Graphical representation of results of Case1 CASE2: Fig.6: Graphical representation of results of Case2 CASE3: Fig. 7: Graphical representation of results of Case3 IV. CONCLUSION AND FUTURE WORK By including inherited elements cohesion can be increased or decreased depending upon design structure of super class and sub class. Additional efforts are requires to measure design complexity by including inherited elements. TCC and LCC are used to measure design complexity of software.
  • 8. An Effort To Improve Cohesion Metrics… www.ijceronline.com ||June ||2013|| Page 15 This study will help to improve the applicability of existing cohesion metrics to measure the requirement of refactoring the classes. LCC helps to assess reusability of code. There are some aspects related to inheritance that are not discussed in this paper for example: Concept of public, private, protected and internal elements require investigation. Concept of direct or indirect call by instance variable should be considered. REFERENCES [1] Improving Applicability of Cohesion Metrics Including Inheritance”, Jaspreet Kaur, Rupinder Kaur, International Journal of Application or Innovation in Engineering & Management (IJAIEM) [2] Empirical Study of Object-Oriented Metrics”, K.K.Aggarwal, Yogesh Singh, Arvinder Kaur, Ruchika Malhotra, JOURNAL OF OBJECT TECHNOLOGY [3] Observations on Lack of Cohesion Metrics”, Sami Mäkelä and Ville Leppänen, International Conference on Computer Systems and Technologies - CompSysTech’06 [4] Comparison of Various Lacks of Cohesion Metrics”, Taranjeet Kaur, Rupinder Kaur, International Journal of Engineering and Advanced Technology (IJEAT) [5] A Proposal for Normalized Lack of Cohesion in Method (LCOM) Metric Using Field Experiment”, Ezekiel Okike, IJCSI International Journal of Computer Science Issues, Vol. 7, Issue 4, No 5, July 2010 [6] An Object-Oriented High-Level Design-Based Class Cohesion Metric”, Jehad Al Dallal, [7] Using Object-Oriented Metrics for Automatic Design Flaws Detection in Large Scale Systems”, Dipl.-Ing. Radu Marinescu [8] Mathematical Validation of Object-Oriented Class Cohesion Metrics”, Jehad Al Dallal, INTERNATIONAL JOURNAL OF COMPUTERS Issue 2, Volume 4, 2010 [9] Modeling Class Cohesion as Mixtures of Latent Topics” [10] Design ACM TOSEM, April 2006 Steve Counsell, Stephen Swift, and Jason” [11] http://www.aivosto.com/project/help/pm-oo-cohesion.html [12] The Impact of Inheritance on the Internal Quality Attributes of Java Classes”, Jehad Al Dallal Department of Information Science- Kuwait University [13] Identification of nominated classes for software refactoring using Object –Oriented Cohesion metrics”, Safwat M. Ibrahim, Sameh A. Aalem, Manal A. Ismail and Mohamed Eladawy [14] Complexity Identification of Inheritance and Interface based on Cohesion and Coupling Metrics to Increase Reusability”, Maya Yadav, Jasvinder Pal Singh, Pradeep Baniya, International Journal of Computer Applications (0975 – 8887)