Software Maintainability and Reusability Using Cohesion Metrics
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Computer Trends and Technology (IJCTT) – Volume 54 Issue 2-December2017 Software Maintainability and Reusability using Cohesion Metrics Adekola, O.D#1, Idowu, S.A*2, Okolie, S.O#3, Joshua, J.V#4, Akinsanya, A.O*5, Eze, M.O#6, EbiesuwaSeun#7 #1Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria *2Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria #3Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria #4Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria *5Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria #6Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria #7Faculty, Computer Science Department, Babcock University,Ilishan-Remo, Ogun State, Nigeria Abstract - Among others, remarkable external software’s lifetime. Ahn et al., (2003) estimated that quality attributes of interest to software practitioners/ maintenance takes up to 80% of the total costof engineers include testability, maintainability and producing software applications. Expectation of reusability.Software engineers still combat achieving more reliable, quicker time-to-market and softwarecrisis and even chronic software affliction maintainable systems. A lot of research has gone into not because there is no standardized software the areas of software reuse and maintenance due to development process but because enough attention is the fact that these among other issues concern not given to seemingly insignificant but crucial intimately system developers/architects/engineers details of internal design attributes such as cohesion rather than end-users. Therehas been enormous and coupling especially in object-oriented systems. growth in software reuse research from the days of Consequently, the aftermath is increased structured programming concepts to object-oriented maintenance cost, effort and time which negatively methods and beyond (e.g. component based plague both the developers and users community. development) (Wang, 2000). Also, reusability being an important part of quality design and time-to-market is equally affected. Most times, software developers have the capability of creating or producing software that functionas This work addresses how to use internal attribute as desired. Theirutmostchallengeis finding ways to cohesion could improve software maintainability and produce software quickly enough to meet up with the reusability. This research also addresses general growing demand for more products and at the same design principles of object-oriented and other reuse- time having to maintain increasingly thriving oriented systems. software “crisis”. Pressman& Maxim, (2015) express the phenomena as software affliction, a long-lasted Keywords: Testability, Maintainability, Reusability, pain or distress. This work does not look in the Cohesion, Coupling, Software Affliction direction of software development life cycle or process flow but rather seeks to consider internal I. INTRODUCTION attributes such as source line of code (SLOC), complexity, cohesion and coupling with a narrowed Maintainability in software constitutes effort and ease focus on cohesion. The most important software required to modify, correct or improve the quality of internal quality metrics are cohesion and coupling a design or product. Maintenance could be done as a (Chidamber&Kemerer, 1994). Generally, internal result of a need to add new features or functionalities, attributes (such as size and cohesion) whether in fix a bug or to increase the strength of the software. traditional or object orientedmethods are critical Maintenance constitutes an essential part of indicators of external attributes which include ISSN: 2231-2803 http://www.ijcttjournal.org Page 63 International Journal of Computer Trends and Technology (IJCTT) – Volume 54 Issue 2-December2017 understandability, maintainability and reusability. A clever but vital area to consider when it comes to attempting to alleviate software afflictionis toexamine what could be done with internalproperties such as complexity, cohesion, coupling etc.Common questions from literature include the following: are highly cohesivemodulesorcomponentsmore readily reusable, does attention to cohesion yield maintainable systems, do wehave a one-size-fit-all when it comes to software metrics to measure major external attributes?A software metric is a quantifiable measurement of some attributesor an attribute of a software product or process (Frakes& Kang, 2005). A mapping of empirical world to formal, relational world is what is termed as measurement (Fenton &Pfleeger, 2010). Therefore, a measure is regarded as thenumber or symbol assigned to anentity bysuch Fig 1: Simple illustration of cohesion and coupling; the thick mapping in a bid to get an attribute characterized. lines indicate cohesion and the dotted lines indicate coupling(Source: Adapted from Dhanvani, 2013) Cohesion implies the degree of relatedness among class members while coupling simply connotes There are many cohesion metrics in literature but the theinterconnectedness of modules within a software metric to employ for a particular instanceneeds to be or a program. A class with high cohesion will be a found out. Mal andRajnish, (2014), discussed a difficult candidate for refactoring, i.e. difficult to split number of metrics which were empirically validated into separate classes (Dallal& Briand, 2009).From against notable open source software projects. their meanings, high cohesion and low couplingshould implya good design as far as software II. METHODOLOGY is concerned. High cohesion,which is ranged within This research embodies case studies, systematic [0,1] shows good design as well as goodquality literature reviews and surveys. Important software (Chidamber&Kemerer, 1994; Okike, 2010a; requirements were identified in related papers. The Okike&Osofisan, 2008; Okike&Rapo, 2015). relevant documents obtained were qualitatively Further, cohesion is a measure of the degree of analyzed for convergence, and relevant details were connectivity among a single class- suffice to say it extracted using inductive approach. Existing reveals or indicates the relationship within a module. measures were evaluated. This work leveraged on For coupling, it is in order to say it indicates Chidamber and Kemerer metrics and Rajnish and relationships between modules or components of a Mal metrics and made proposition on inclusion of software or system. Cohesion measures how one method-method interaction as part of consideration function performed by an entity relate to another. It is for cohesion measures. characteristic of most metrics to evaluate cohesion by considering if methods of a class access similar sets III. LITERATURE REVIEW of instance variables (Mal &Rajnish, 2014).Coupling In software engineering, qualities such as connotes how much a component knows about the maintainability, reusability, flexibility, writeability inner workings (elements) of the other. and demonstrability are described as developer- orientedquality attributes (Berander, Damm, Eriksson, Gorschek, Henningsson, Jönsson, Kågström, Milicic, Mårtenssonn, Rönkkö, &Tomaszewski, 2005). While these are external software quality attributes, internal qualities are the likes of size, complexity, cohesion and coupling. The internal versus external quality attributes relationship could be fashionably intuitive, for example the more complex a code is the more difficult it is to maintain. ISSN: 2231-2803 http://www.ijcttjournal.org Page 64 International Journal of Computer Trends and Technology (IJCTT) – Volume 54 Issue 2-December2017 But,the exact functional form of the relationship is and getting Staff related data. It does not include not very lucid. Therefore, this is connotes a subjectof operations that should be handled by or separated to serious research issue. another class. IV. COHESION A. Types of Cohesion Using class illustration, cohesion means the extent or which a class carries a single, well-focused degree The following are the variousclassifications of purpose. By implication, a better design should own cohesion that require research attention: high cohesion.It means a class encapsulates only 1. Functional Cohesion: This means the properties and operations that are closely related. various constituent elementsthat make up Interestingly, high cohesion is a desirable property of the module or component are grouped a program in that it positively impacts together simply because each or almost understandability, maintenance and reuse (Girish, everyone in the group contributes to the 2014). An intimate example could be to illustrate module’s single responsibility or well- cohesion as communication between father, mother, focused task. and child within a family while its counterpart called 2. Informational cohesion: Here,the entity is coupling could be communication in between two said to represent a cohesive body of data and different families. a set or group of independent actions or behaviours on the particular body of data. Consider the following unified modeling 3. Sequential Cohesion: This grouping occurs when parts of the modules output represent language(UML) class example: the input to the other. Staff 4. Communication Cohesion: This is when parts of the module are organized in a group +checkMail() because they use or work on the same data. +sendMail() 5. Procedural