International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5                             ...
International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Viewpoints                   ...
International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5• A worst case value for poss...
International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Figure 1 shows a method with ...
International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5extensive applied research to...
International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Conclusion                   ...
Upcoming SlideShare
Loading in …5
×

IJCER (www.ijceronline.com) International Journal of computational Engineering research

303 views

Published on

Call for paper 2012, hard copy of Certificate, research paper publishing, where to publish research paper,
journal publishing, how to publish research paper, Call For research paper, international journal, publishing a paper, IJCER, journal of science and technology, how to get a research paper published, publishing a paper, publishing of journal, publishing of research paper, research and review articles, IJCER Journal, How to publish your research paper, publish research paper, open access engineering journal, Engineering journal, Mathematics journal, Physics journal, Chemistry journal, Computer Engineering, Computer Science journal, how to submit your paper, peer review journal, indexed journal, research and review articles, engineering journal, www.ijceronline.com, research journals,
yahoo journals, bing journals, International Journal of Computational Engineering Research, Google journals, hard copy of Certificate,
journal of engineering, online Submission

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
303
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

IJCER (www.ijceronline.com) International Journal of computational Engineering research

  1. 1. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5 Analysis of object Oriented Metrics 1. Dr.R.V.Krishnaiah, 2.BANDA SHIVA PRASADAbstractNow a days Software development plays vital role in the We can signify nine classes of Object Oriented Metrics.world. We focus on process improvement has increased In each of then an aspect of the software would bethe demand for software measures, or metrics with which measured:to manage the process. Measurement is fundamental to  Sizeany engineering discipline. There is considerable  Population (# of classes, operations)evidence that object-oriented design metrics can be used  Volume (dynamic object count)to make quality management decisions. This leads to  Length (e.g., depth of inheritance)substantial cost savings in allocation of resources for  Functionality (# of user functions)testing or estimation of maintenance effort for a project.  ComplexityThe need for such metrics is particularly acute when an How classes are interrelatedorganization is adopting a new technology for which Coupling, collaborations between classes, number ofestablished practices have yet to be developed. This method calls, etc.Sufficiency Does a class reflect theresearch addresses these needs through the development necessary propertiesof the problem domain?Completenessand implementation of a suite of metrics for OO design. Does a class reflect all the properties of the problemThe metric values have been calculated using a semi domain? (for reuse) CohesionDo the attributes andautomated tool. The resulting values have been analyzed operations in a class achieve a single, well-definedto provide significant insight about the object oriented purpose in the problemdomain?Primitiveness (Simplicity)characteristics of the projects. Degree to which class operations can’t be composed from other operationsSimilarity Comparison of structure,Index Terms function, behavior of two or more classesVolatilityTheObject Oriented, Design, Development, Metric, Measure, likelihood that a change will occur in the design orCoupling, Cohesion, Complexity, Size implementation of a classIntroduction MetricsObject-Oriented Analysis and Design of software provide Chidamber and Kemerers metrics suite for OO Design ismany benefits such as reusability, decomposition the deepest research in OO metrics investigation.of problem into easily understood object and the aiding of They have defined six metrics for the OO design.future modifications. But the OOAD software In this section we’ll have a complete description of theirdevelopment life cycle is not easier than the typical metrics:procedural approach. Therefore, it is necessary toprovide dependable guidelines that one may follow to Metric 1: Weighted Methods per Class (WMC)help ensure good OO programming practices and Definition: Consider a Class C1, with methods M1... Mnwrite reliable code. Object-Oriented programming metrics that are defined in the class. Let c1... cn be theis an aspect to be considered. Metrics to be a set complexity of the methods. Then:of standards against which one can measure theeffectiveness of Object-Oriented Analysis techniques inthedesign of a system.Five characteristics of Object Oriented Metrics are as If all method complexities are considered to be unity, thenfollowing: WMC = n, the number of methods.1. Localization operations used in many classes Theoretical basis: WMC relates directly to Bunges12. Encapsulation metrics for classes, not modules definition of complexity of a thing, since methods are3. Information Hiding should be measured & improved properties of object classes and complexity is determined4. Inheritance adds complexity, should be measured by the cardinality of its set of properties. The5. Object Abstraction metrics represent level of number of methods is, therefore, a measure of class abstraction definition as well as being attributes of a class, since attributes correspond to properties.Issn 2250-3005(online) September| 2012 Page 1474
  2. 2. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Viewpoints • The number of children gives an idea of the potential• The number of methods and the complexity of methods influence a class has on the design. If a class has a involved is a predictor of how much time andeffort is large number of children, it may require more testing of required to develop and maintain the class. the methods in that class.• The larger the number of methods in a class the greater the potential impact on children, since children Metric 4: Coupling between object classes (CBO) will inherit all the methods defined in the class. Definition: CBO for a class is a count of the number of• Classes with large numbers of methods are likely to be other classes to which it is coupled. more application specific, limiting the possibility Theoretical basis: CBO relates to the notion that an object of reuse. is coupled to another object if one of them acts on the other, i.e., methods of one use methods or instanceMetric 2: Depth of Inheritance Tree (DIT) variables of another. As stated earlier, sinceDefinition: Depth of inheritance of the class is the DIT objects of the same class have the same properties, twometric for the class. In cases involving multiple classes are coupled when methods declared in oneinheritance, the DIT will be the maximum length from the class use methods or instance variables defined by thenode to the root of the tree. other class.Theoretical basis: DIT relates to Bunges notion of the Viewpoints:scope of properties. DIT is a measure of how many • Excessive coupling between object classes is detrimentalancestor classes can potentially affect this class. to modular design and prevents reuse. The more independent a class is, the easier it is to reuse it inViewpoints: another application.• The deeper a class is in the hierarchy, the greater the •In order to improve modularity and promote number of methods it is likely to inherit, making it ncapsulation, inter-object class couples should be kept to more complex to predict its behavior. aminimum. The larger the number of couples, the higher• Deeper trees constitute greater design complexity, the sensitivity to changes in other parts of the since more methods and classes are involved. design, and therefore maintenance is more difficult.• The deeper a particular class is in the hierarchy, the • A measure of coupling is useful to determine how greater the potential reuse of inherited methods. complex the testings of various parts of a design are likely to be. The higher the inter-object class coupling, the1 The ontological principles proposed by Bunge in his more rigorous the testing needs to be. “Treatise on Basic Philosophy” form the basis of the concept of objects. Metric 5: Response for a Class (RFC) While Bunge did not provide specific ontological Definition: RFC = | RS | where RS is the response set for definitions for object oriented concepts, several recent the class.Theoretical basis: The response set for the class researchers have employed can be expressed as:RS = { M }È all i { Ri }where { Ri } his generalized concepts to the object oriented domain. = set of methods called by method i and { M } = set of all methods in the class The responseset of a class is a set ofMetric 3: Number of children (NOC) methods that can potentially be executed in response to aDefinition: NOC = number of immediate sub-classes message received by anobject of that class26. Thesubordinated to a class in the class hierarchy. cardinality of this set is a measure of the attributes ofTheoretical basis: NOC relates to the notion of scope of objects in the class. Since itspecifically includes methodsproperties. It is a measure of how many subclasses called from outside the class, it is also a measure of theare going to inherit the methods of the parent class. potentialcommunication between the class and other classes.Viewpoints: Viewpoints:• Greater the number of children, greater the reuse, since • If a large number of methods can be invoked in response inheritance is a form of reuse. to a message, the testing and debugging of the• Greater the number of children, the greater the class becomes more complicated since it requires a likelihood of improper abstraction of the parent class greater level of understanding required on the part of . If a the tester. class has a large number of children, it may be a case • The larger the number of methods that can be invoked of misuse of sub-classing. from a class, the greater the complexity of the class.Issn 2250-3005(online) September| 2012 Page 1475
  3. 3. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5• A worst case value for possible responses will assist in Method Hiding Factor ( MHF )appropriate allocation of testing time. MHF is defined as the ratio of the sum of the invisibilitiesMetric 6: Lack of Cohesion in Methods (LCOM) of all methods defined in all classes to the totalDefinition: Consider a Class C1 with n methods M1, number of methods defined in the system underM2..., Mn. Let {Ij} = set of instance variables used by consideration.The invisibility of a method is themethod Mi. There are n such sets {I1},... {In}. Let P = { percentage of the total classes from which this method is(Ii,Ij) | Ii Ç Ij = Æ } and Q = { (Ii,Ij) | Ii Ç Ij _ Æ }. not visible.note : inherited methods not considered.If all n sets {I1},... {In} are Æ then let P = Æ. Attribute Hiding Factor ( AHF )LCOM = |P| - |Q|, if |P| > |Q| AHF is defined as the ratio of the sum of the invisibilities= 0 otherwise28Example: Consider a class C with three of all attributes defined in all classes to the totalmethods M1, M2 and M3. Let {I1} = {a,b,c,d,e} and {I2} number of attributes defined in the system under= {a,b,e}and {I3} = {x,y,z}. {I1} Ç {I2} is non-empty, consideration.but {I1} Ç {I3} and {I2} Ç {I3} are null sets. LCOM is Method Inheritance Factor ( MIF )the(number of null-intersections - number of non-empty MIF is defined as the ratio of the sum of the inheritedintersections), which in this case is 1.Theoretical basis: methods in all classes of the system underThis uses the notion of degree of similarity of methods. consideration to the total number of available methods (The degree of similarity for twomethods M1 and M2 in locally defined plus inherited) for all classes.class C1 is given by:s() = {I1} Ç {I2} where {I1} and Attribute Inheritance Factor ( AIF ){I2} are the sets of instance variables used by M1 and M2 AIF is defined as the ratio of the sum of inheritedThe LCOM is a count of the number of method pairs attributes in all classes of the system under considerationwhose similarity is 0 (i.e. s() is a null set) minus thecount to the total number of available attributes ( locally definedof method pairs whose similarity is not zero. The larger plus inherited ) for all classes.the number of similar methods, the morecohesive the Polymorphism Factor ( PF )class, which is consistent with traditional notions of PF is defined as the ratio of the actual number of possiblecohesion that measure the interrelatednessbetween different polymorphic situation for class Ci to theportions of a program. If none of the methods of a class maximum number of possible distinct polymorphicdisplay any instance behavior,i.e. do not use any instance situations for class Ci.variables, they have no similarity and the LCOM value Coupling Factor ( CF )for the class will be zero.The LCOM value provides a CF is defined as the ratio of the maximum possiblemeasure of the relative disparate nature of methods in the number of couplings in the system to the actual numberclass. A smallernumber of disjoint pairs (elements of set of couplings not imputable to inheritance.P) implies greater similarity of methods. LCOM is 4. Some Traditional Metricsintimately tiedto the instance variables and methods of a There are many metrics that are applied to traditionalclass, and therefore is a measure of the attributes of an functional development. The SATC2, from experience,objectclass. has identified three of these metrics that are applicable toViewpoints: object oriented development: Complexity, Size,• Cohesiveness of methods within a class is desirable, and Readability. To measure the complexity, thesince it promotes encapsulation. cyclomatic complexity is used.• Lack of cohesion implies classes should probably be 2 Software Assurance Technology Center (SATC) atsplit into two or more sub-classes. NASA Goddard• Any measure of disparateness of methods helps identify Space Flight Centerflaws in the design of classes. Metric 1: Cyclomatic Complexity (CC)• Low cohesion increases complexity, thereby increasing Cyclomatic complexity (McCabe) is used to evaluate thethe likelihood of errors during the development complexity of an algorithm in a method. It is aprocess. count of the number of test cases that are needed to test the method comprehensively. The formula for3. MOOD (Metrics For Object Oriented Design) calculating the cyclomatic complexity is the number ofThe MOOD metrics set refers to a basic structural edges minus the number of nodes plus 2. For amechanism of the OO paradigm as encapsulation ( MHF sequence where there is only one path, no choices orand AHF ), inheritance ( MIF and AIF ), polymorphisms ( option, only one test case is needed. An IF loopPF ) , message-passing ( CF ) and are expressed however, has two choices, if the condition is true, oneas quotients. The set includes the following metrics: path is tested; if the condition is false, an alternative path is tested.Issn 2250-3005(online) September| 2012 Page 1476
  4. 4. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Figure 1 shows a method with a low cyclomatic As discussed, many different metrics have been proposedcomplexity is generally better. This may imply decreased for object oriented systems.testing and increased understandability or that decisions The object oriented metrics that were chosen by theare deferred through message passing, not that the SATC measure principle structures that, if improperlymethod is not complex. Cyclomatic complexity cannot be designed, negatively affect the design and code qualityused to measure the complexity of a class attributes.because of inheritance, but the cyclomatic complexity of The selected object oriented metrics are primarily appliedindividual methods can be combined with other to the concepts of classes,measures to evaluate the complexity of the class. coupling, and inheritance. Preceding each metric, a briefAlthough this metric is specifically applicable to the description of the object oriented structure is given. Forevaluation of Complexity, it also is related to all of the some of the object-oriented metrics discussed here,other attributes multiple definitions are given; researchers andThe SATC’s approach to identifying a set of object practitioners have not reached a common definition ororiented metrics was to focus on the counting methodology. In some cases, the countingprimary, critical constructs of object oriented design and method for a metric is determined by the softwareto select metrics that apply to those areas. The suggested analysis package being used to collect the metrics.metrics are supported by most literature and some object Recall, a class is a template from which objects can beoriented tools. created. This set of objects sharesThe metrics evaluate the object oriented concepts: a common structure and a common behavior manifestedmethods, classes, coupling, and inheritance. The metrics by the set of methods. A method is an operation upon anfocus on internal object structure that reflects the object and is defined in the class declaration. A messagecomplexity of each individual entity and on external is a request that an object makes of another object tocomplexity that measures the interactions among entities. perform an operation. The operation executed as a resultThe metrics measure computational complexity that of receiving a message is called a method. Cohesion is theaffects the efficiency of an algorithm and the use of degree to which methods within a class are related to onemachine resources, as well as psychological complexity another and work together to provide well-boundedfactors that affect the ability of a programmer to create, behavior. Effective object oriented designs maximizecomprehend, modify, and maintain software. cohesion because cohesion promotes encapsulation.We support the use of three traditional metrics and Coupling is a measure of the strength of associationpresent six additional metrics established by a connection from one entity to another.specifically for object oriented systems. The SATC has Classes (objects) are coupled when a message is passedfound that there is considerable between objects; when methods declared in one class usedisagreement in the field about software quality metrics methods or attributes of another class. Inheritance is thefor object oriented systems. hierarchical relationship among classes that enablesSome researchers and practitioners contend traditional programmers to reuse previously defined objectsmetrics are inappropriate for object oriented systems. including variables and operators. [2, 3, 5, 8]There are valid reasons for applying traditional metrics,however, if it can be done. The traditional metrics have METRIC: Depth of Inheritance Tree (DIT)been widely used, they are well understood by researchers The depth of a class within the inheritance hierarchy is theand practitioners, and their relationships to software maximum number of stepsquality attributes have been validated . from the class node to the root of the tree and is measuredTable 1 presents an overview of the metrics applied by the by the number of ancestor classes.SATC for object oriented The deeper a class is within the hierarchy, the greater thesystems. The SATC supports the continued use of number methods it is likely to inherit making it moretraditional metrics, but within the structures and confines complex to predict its behavior. Deeper trees constituteof object oriented systems. The first three metrics in Table greater design complexity, since more methods and1 are examples of traditional metrics applied to the object classes are involved, but the greater the potential for reuseoriented structure of methods instead of functions or of inherited methods.procedures. The next six metrics are specifically forobject oriented systems and the object oriented construct For many of the metrics, it is more effective to analyzeapplicable is indicated. the modules using two metrics.Object-Oriented Specific Metrics In Figure 12 the methods are plotted based on size and complexity. The SATC has doneIssn 2250-3005(online) September| 2012 Page 1477
  5. 5. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5extensive applied research to identify the preferred values. AdvantageThe “risk regions” shown indicate where methods have  We can predict the fault prediction using high cohesionthe potential for poor quality that will effect maintainability, reusability and readability. (These regions of risk Approacheswere developed for non object oriented code and are  Retrieving the structured information.expected to decrease in size with further research.) The  Check the availability of structured information foryourtable below the graph summarizes the diagram. source code.  Apply the LCOM5 formula for structured information.  Analyze about the comments i.e. unstructured information.  Index Searching  Apply the Conceptual similarity formula.  Comparison Approach-1: In this Approachwe are going to take the structured information like identifiers, (Example Variables). Invocation of declared methods and declared constructors.SUMMARY Here the Java program should be well compiled and itObject oriented metrics help evaluate the development should be valid comments.and testing efforts needed, theunderstandability, maintainability and reusability. This Approach-2:information is summarized in Table 4. In this Approachdeals we are going to search the declared variables among all the classes. Because the main theme of the declaring class variable is, it should be used in all methods. So that the declared variables are found among all the methods. Approach-3: In this Approachwe are going to apply the LCOM5 (Lack of cohesion in methods) formula. If the result is equal toExisting work: one means, the class is less cohesive according to theStructural metrics are calculated from the source code structured information.such as references and data sharing between methods of Approach-4:a class belong together for cohesion. Here we are going to retrieve the index terms based on1. It define and measure relationships among the methods that comments which are present in all the methods. of a class based on the number of pairs of methods that Comments are useful information according to the share instance or class variables one way or another for software engineer. In concept oriented analysis we are cohesion. taking the comments. Based on the comments we areDisadvantage going to measure the class is cohesive or not. Lacking of high cohesion Approach-5: In this Approachwe are going to check the index termsProposed System: among the comments which are present in all the1. In proposed System unstructural information is comments. retrieved from the source code like comments and Approach-6: identifiers. In this Approachwe are going to apply the conceptual2. Information is retrieved from the source code using similarity formula. Based on the result we can say the Latent Semantic Indexing. class is cohesive or less cohesive according to concept3. With the help of C3 and existing metrics we are oriented. achieving the high cohesion and low coupling. Approach-7: In this Approachwe are going to compare the two results. Based on the results we can say that cohesion according to structure oriented and unstructured oriented.Issn 2250-3005(online) September| 2012 Page 1478
  6. 6. International Journal Of Computational Engineering Research (ijceronline.com) Vol. 2 Issue. 5Conclusion AUOTHERS PROFILES:We conclude that the Object oriented metrics exist anddo provide valuable information to object orienteddevelopers and project managers. The SATC has foundthat a combination of “traditional” metrics and metricsthat measure structures unique to object orienteddevelopment is most effective. This allows developers tocontinue to apply metrics that they are familiar with, suchas complexity and lines of code to a new development 1.Dr.R.V.Krishnaiahenvironment. However, now that new concepts and M.Tech(EIE),M.Tech(CSE), PhD,MIE,MIETE,MISTEstructures are being applied, such inheritance, coupling, Principal,cohesion, methods and classes, metrics are needed to DRK INSTITUTE OF SCINCE & TECHNOLOGY,evaluate the effectiveness of their application. Metrics Hyderabad.such as Weighted Methods per Class, Response for aClass, and Lack of Cohesion are applied to these areas.The application of a hierarchical structure also needs to beevaluated through metrics such as Depth in Tree andNumber of Children. At this time there are no clearinterpretation guidelines for these metrics although thereare guidelines based on common sense and experience.References BANDA SHIVA PRASAD1. Booch, Grady, Object Oriented Analysis and Design with M.TECH -SE Applications, The Benjamin/Cummings Publishing Company, Inc., 1994. DRK INSTITUTE OF SCINCE & TECHNOLOGY,2. Chidamber, Shyam and Kemerer, Chris, “A Metrics Suite Hyderabad. for Object Oriented Design”, IEEE Transactions on Software Engineering, June, 1994, pp. 476-492.3. Hudli, R., Hoskins, C., Hudli, A., “Software Metrics for Object Oriented Designs”, IEEE, 1994.4. acobson, Ivar, Object Oriented Software Engineering, A Use Case Driven Approach, Addison-Wesley Publishing Company, 1993.5. Lee, Y., Liang, B., Wang, F., “Some Complexity Metrics for Object Oriented Programs Based on Information Flow”, Proceedings: CompEuro, March, 1993, pp.6. Lorenz, Mark and Kidd, Jeff, Object Oriented Software Metrics, Prentice Hall Publishing, 1994.7. McCabe & Associates, McCabe Object Oriented Tool User’s Instructions, 1994.8. Rosenberg, Linda H., “Metrics for Object Oriented Environments”, EFAITP/AIE Third Annual Software Metrics Conference, December, 97.9. Sommerville, Ian, Software Engineering, Addison-Wesley Publishing Company, 1992.10. Sharble, Robert, and Cohen, Samuel, “The Object Oriented Brewery: A Comparison of Twoobject oriented Development Methods”, Software Engineering Notes, Vol 18, No 2., April1993, pp 60 -73.Issn 2250-3005(online) September| 2012 Page 1479

×