• No results found

A Software Code Complexity Framework; Based on an Empirical Analysis of Software Cognitive Complexity Metrics using an Improved Merged Weighted Complexity Measure

N/A
N/A
Protected

Academic year: 2020

Share "A Software Code Complexity Framework; Based on an Empirical Analysis of Software Cognitive Complexity Metrics using an Improved Merged Weighted Complexity Measure"

Copied!
12
0
0

Loading.... (view fulltext now)

Full text

(1)

Volume 4, No. 8, May-June 2013

International Journal of Advanced Research in Computer Science

RESEARCH PAPER

Available Online at www.ijarcs.info

© 2010, IJARCS All Rights Reserved 51

ISSN No. 0976-5697

A Software Code Complexity Framework; Based on an Empirical Analysis of Software

Cognitive Complexity Metrics using an Improved Merged Weighted Complexity Measure

Dr Wafula Joseph Director ICT JKUAT – Juja, Kenya.

Dr. Waweru Mwangi Director - ICSIT JKUAT - Juja, Kenya.

Stephen N. Waweru*

Student - Masters in Software Engineering -

Institute of Computer Science & Information Technology (ICSIT) JKUAT – Juja, Kenya

stiiv2005@yahoo.com

Abstract: This research paper proposes a Software Complexity Code Framework Based on an empirical analysis of Software Cognitive Complexity Metrics using an Improved Merged Weighted Complexity Measure. Software Development Industry in Kenya is dominated by a myriad of Small Software Developers firms. It was observed that majority of the Small Software Developers Organizations have 2 - 20 employees indexed by 62.4%, whereas Large Software Developers Organizations index 30.4% [1]. The increased complexity of modern software applications also increases the difficulty of making the code reliable and maintainable. This research paper measures one internal measure of software products, namely software complexity. I develop a Software Code Complexity Framework using a proposed cognitive complexity metric for evaluating design of object-oriented (OO) code. The proposed metric is based on important features of the Object Oriented Systems: Inheritance, Control Structures, Nesting and Size. The proposed metric is applied on a real project for empirical validation and compared with Chidamber and Kemerer (CK) metrics suite [2]. The practical and empirical validations and the comparative study prove the robustness of the measure. The outcome of this Model leads to a development of Software Code Complexity Framework; a tool-set for static analysis of Java/C/C++ source code: a combination of automatic code review and automatic coding standards enforcement.

Keywords: Software Code complexity, Metric, Framework, Object Oriented System, Cognitive Complexity

I. INTRODUCTION

Object Oriented scheme have come to control software engineering over the last two decades. The improvement and modification in these techniques are still undergoing research [1]. More and more organizations are adopting these techniques into their software development practices. A result of the growth in popularity of object oriented programming is the introduction of number of software design metrics. Although most of these metrics are applicable to all programming languages, some metrics apply to a specific set of programming languages [2], among these metrics some have been proposed based on cognitive complexity called Cognitive Complexity Metrics. Wang [3] observed that the traditional measurements cannot actually reflect the real complexity of software systems in software design, representation, cognition, comprehension, and maintenance. Today, the relevant literature provides a variety of object oriented metrics [4-5], to compute the complexity of software.

The metrics presented in this survey are for Object– oriented programming. Still there are other Object Oriented Cognitive Complexity Metrics specially developed for Object Oriented programs. Cognitive complexity measures are the human effort needed to perform a task difficulty in understanding the software. The cognitive complexity is an ideal measure of software functional complexities and sizes,

because it represents the real semantic complexity by integrating both the operational and architectural complexities. In this research paper, an attempt has been made to develop a very simple Framework for calculating the complexity of code in terms of cognitive weights. This method is the most suitable due to not only its simplness but also it provides the complete information about the information contents of a Program code. There is continuous effort to find a comprehensive complexity metric, which addresses most ofthe parameters of software. The outcome of this research paper leads to automation of the Merged Weighted Complexity Metric including other complexity metrics by developing a; Software Code Complexity Framework;a tool-set for Static Analysis of Object Oriented Systems Source Code. a combination of Automatic Code Review and Automatic Coding Standards Enforcement.

II. SOFTWARE COMPLEXITY

(2)

deep dental complex roblem and ma plication. Impl propriate data s

em. Software many researcher he difficulty ware.

deals with the rding to H plexity of soft ware that affect rming a given plexity as a m m while intera ven task. Softw

e definition be ware. So, differ oftware compl for the same i ware complexity

evelopment, te fault prone ware/module i

tain and has ed as “the deg sign or implem verify” i.e. com e understandab cult to understa

igure 1 shows cs that define s a segment of arious comple itance and siz has been taken

igure 1: Maintaina

III. R

Problem State

here are too uring and anal most important

is needed to xity is the resul ay be equivalen

ementing wro structure adds complexity ha rs. Zuse [8] de to maintain,

e psychologica Henderson-Sell

tware refers t t the level of r n task on it. B measure of the

acting with a pi ware complexit ecause it is mu rent researchers exity. Therefo in literature. H y is useful in esting, mainte modules a is difficult to

higher fault gree to which a mentation that mplexity of a bility. All the f and are respons the quality att es software m

f sub-attribute xity metrics i ze. The Intern n as a baseline.

ability Attributes, S

RESEARCH

ement:

many popul lyzing softwar t complexity

o understand lt of poor attem nt to what som

ng design or accidental com as been define efines software

change and

al complexity o ers [9] the o those chara resources used asili [10] defin resources exp iece of softwar

ty cannot be d ultidimensional

s/users have di ore, no standar However, know many ways. It enance etc. ef and reliability

o develop, t rate. Complex a system or com

is difficult to code is directl factors that ma sible for compl tributes, sub a maintainability. s, which can b i.e. nesting pa national Standa

.

Sub-attributes and M

CONCEPT

ar and simpl re code that do factors. As al

a problem. mpts to solve me are calling selecting an mplexity to a d differently e complexity understand

of programs. e cognitive acteristics of

by a person nes software pended by a re to perform defined by a l attribute of ifferent view rd definition wledge about t is indicator fforts, defect y. Complex

test, debug, xity [11] is mponent has o understand ly dependent akes program

lexity. attributes and

Complexity be measured ath, depth of ard ISO/IEC

Metrics [6]

le tools for o not include

lready noted

before, deals w and the

B.

The Cognit the sm survey Softwa testing logic d require simple Oriente

C.

The the imp Oriente investig quality softwar typical survey order t used as think i process collecti reason were c groups questio out tha use Me majorit have n how th across functin

, various old re code comple e available to

cteristics in m ode, which dire

exity of a cod tanding of ehension and

exity is defined with the code,

e maintenance

Research Motiv

e aim of this su ive Complexit all software de

will also all are Code Co ring and anal wer them to nance effort, re overall qua um effort and and guide the during develop e in-depth an

to use, easy to ed programmin

Reserch Survey

e main purpose pact of softwar ed and to exte

gating its stati y. To ascertain re developers

example of re was appropria to identify po s indicator of e is most impo ses/activities. ing informatio

for this was categorized and

using a scale ons and answer ch. Another iss hat the result gated in orde ons. To achieve mall Software D Table 1 and fig at a small numb etrics as a too ty (95.8%) ha no indication o hey work.Very metrics but nalities.

tools for m exity are under ools do not measuring and a ectly affects th de directly affe

a code is is a cognitive d as the menta

for instance, th staff [6].

vation:

urvey is to list ty Object Orien

evelopers awar ow small soft omplexity Fra lyzing softwar o predict rat scheduling ality of their d best areas

testing proces pment because

alysis of pro o apply and ca ng language i.e

y:

e of this resear re complexity i ernally validat istical relations this, informati

companies w esearch in the l ate to use. The ssible complex external quality ortant for thei

The approach on was a qua

that the quest d the answers

from one to t rs is typical for

sue that affecte was to be an er to find re e this task a qu Developers.

gure 2 below, ber (4.8%) of s l for measurem ave no idea of

f what metrics y few develope they ignore

measuring and r several critic

consider the analyzing the he Cognitive C ects comprehen known as e process..The al burden on th he developers,

t out some of t nted Metrics an re of their exis ftware develop amework - a re code comp te of errors and reporting

programs, m of concentrat s by limiting th e the framewo ogramming str an be used for e. C/C++ and Ja

rch survey was in software des te design com ship to externa ion from a grou was needed. T

large, which m survey was co xity metrics th y attributes and

r company in used for this antitative appr tions used in were divided hree. Having c r a quantitative ed the choice o nalyzed and s lationships be uestionnaire wa

this research s small software ment and anlay

f what metrics s are, their fun ers agreed to

their impor

analyzing cisms. Most Cognitive complexity Complexity.

nsion. The program e Cognitive he user who , the testers

the existing nd to make stence. The pers to use a tool for plexity and s, predicts

g projects, measure the

ion during he program ork do not ructure, its

any Object ava.

to find out sign Object mplexity by

al software up of small This was a means that a

onducted in hat can be d what they n terms of s study for roach. The the survey d into three categorized e collection of approach statistically etween the as designed

(3)

© 20 Table

Figu

In small agree qualit any i outco better

Table

Figure

Th conne 95.8% softw consi

Steph

010, IJARCS All R e 1: Respondents w

measure

ure 2: Plot of Resp measure

n table 2 and fi l number 12.5 e there is an ov ty attributes. T influence; in ome of coding r Graphical Us

2: Respondents wh on

e 3: A plot of Resp complexity

he survey als ect the impact % of responde ware code com

der a good cod

hen N. Waweru e

Rights Reserved who use Software e and analyze their

pondents who use e and analyze their

figure 3 below % of small so erall influence The remaining 8

fact they see g without err

er Interfaces.

ho agree there is a n External Quality

pondents who agre metrics on Extern

so finds out t of code comp ents do not ag mplexity with de should alwa

etal, Internationa

Design Complexi r Software codes

Design Complexit r Software codes

the survey fin oftware develo e on complexity 87.5% do not a e software qu rors (bugs) an

an overall influenc y Attributes

ee there is an overa nal Quality Attribu

that 4.2% of plexity to softw gree on the as h software qu ays give good s

al Journal of Adv

ty Metrics to

ty Metrics to

nds out that a opers do not y on external agree there is uality as an nd including

e of complexity

all influence of utes

respondents ware Quality. ssociation of uality. They software; the

vanced Research i

idea of softwar associa quality

Table

Fig

The measur cyclom Oviedo measur Knot c are sup clarity parame selectin problem disadva

V. C

The functio compre softwar and ite softwar difficul given s two dif BCS’s others. BCS’s; inner B

in Computer Scie

f software qual re design. Tab ation of softw y.

e 3: Respondents w

gure 4: A plot of R Com

IV. LI

ere are many res that havee matic number [

o’s data flow re [15],Wang’s omplexity [17] pposed to cov of software a eters. Out of ng a particul m, as every m antages.

COGNITIVE

e field of cogn onal complex

ehension is de re. Basic contr eration [18] is re. The cognit lty or relative software mode fferent architec are in a linear For the form ; are added an BCS’s are mu

ence, 4 (8), May–J

lity is the last c ble 3 and Figu ware code co

who connect the Im Software Quali

Respondents who c mplexity to Softwar

ITERATURE

y well know e been propo 12], Halstead p w complexity

s cognitive com ]. All the repor ver the correc and to provide f the numero lar complexity measure has i

E WEIGHTS A

nitive informa xity of soft ependent on in rol structures the basic logi tive weight of e time and ef eled by a num ctures for calcu layout or som mer case, sum

nd for the latt ultiplied with

June, 2013,51-62

consideration d ure 4 below ill omplexity with

mpact of Code Com ity

onnect the Impact re Quality

REVIEW

wn software osed such as

programming measures [14 mplexity measu rted complexity ctness, effectiv e good estimat ous proposed

y measure is its own advan

AND INFORM

atics, it is foun tware in de nternal architec (BCS), sequen ic building blo software is th ffort for comp mber of BCS’s.

ulating Wbcs: ei

e BCS’s are em of the weigh ter, cognitive the weights o

53

during their lustrate the h software

mplexity to

of Code

complexity McCabe’s effort [13], 4], Basili’s

ure[16] and y measures veness and

te of these measures, s again a ntages and

MATICS

nd that the esign and cture of the nce, branch ocks of any he extent of prehending . There are ither all the mbedded in hts of all n

(4)

BCS’

’s. The cogniti s under:

Table 5: Basic co

ategory equence ranch

eration

mbedded omponent

oncurrency

THE ANA ISTING COM COGN

According to W d in Cognitive , mechanisms esses, mental esting in comp ain the mechan thinking. It i nitive Informat

lopment of t matics, compu e are a number ognitive Inform plexity Metric ghted Class Co ritance and (v)

his research plexity (WCC

c description, ation in compa plexity Measur

WEIGHTED

Computation

Mishra [20] mod

c called we dered Object on between th med as a set of complexity o plexity of Meth Weighted Cla

Weighted Clas lated using the

re,

ive weights fo

ontrol structures a

BCS Sequence (SEQ If-Then-Else (IT Case

For-do Repeat-until While-do Function Call (F

Recursion (REC Parallel (REC) Interrupt (INT)

ALYSIS AND MPLEXITY M

NITIVE INFO

Wang [16] the e Informatics a of the natur phenomena puting and soft nisms and proc is expected t ics will profou the next gen uting, software

r of metrics wh matics among c (ii) Class C omplexity (iv) Average Comp paper analy C) Metric, it g

its equation, arison to the pr re.

D CLASS COM

Of Weighted Cl dified the CC m eighted class

Orientation he Data and F

f data and set o of the class

hods and Attrib ass Complexity E

ss Complexity e equation (1)

r Basic Contro

nd their cognitive

W

FINDINGS O MEASURES B

ORMATICS

major problem are: the archite

ral intelligenc and persona tware engineer cesses of memo that any brea

undly pave the neration tech e, and cogniti hich were deve

them; (i) We Complexity (ii Class comple plexity due inh ses (i) Weig gives an anal research find roposed Merge

MPLEXITY (W

lass Complexity

metric and pro complexity as a form of Function, the c

of method acc should be m

butes. Equation:

y (WCC) [2

(1)

ol Structures

Weight

Weight 1 ce, cognitive

ality. It is ring arena to

ory, learning akthrough in

e way to the hnologies in

ive sciences. eloped based eighted Class ii) Extended exity Due to heritance.

ghted Class lyses of the dings and its ed Weighted

WCC) [20]

[20]:

oposed a new (WCC). It f expression

class can be essing them. measured by

20] can be

Na MC

If th total co of indiv

C. R of nine one. W the com High underst Ultima inform should and the conside factors program

A.

A s classes comple level o one (th for tho class, w class (l

B.

A conside assume comple

is the Numb is the Metho equation (2) here are y clas omplexity of th vidual classes.

Research Findi

his proposed m um of compl

exity Due T exity Due To d is calculate ion in Metho utes in the Meth

Weighted Class

eighted Class C internal structu ker’s [19] prop validated and f

e, which estab Weighted Class mplexity of Ob

Weighted Cla tandability and ately, it helps th

ation. Howe not only con e number of a er the conc sulation, Overl

THE MERG ME

ftware complex eter of p

imensional at which c m/software are

Inheritance

statement whic s is harder to

exity than oth f classes by as he outermost le ose statements

weight 2 to tho level 3) and so

Types of Co

program/class ered to be m e that differen exity of a pro

ber of Attribute od Complexity

sses in an objec he code is give

ings

measure, the co exity of the To Data Mem

Message Call ed by Compl d and as wel hod.

Complexity Li

Complexity inc ure of methods perties Weighte found that it sa lished this me s Complexity bject Oriented ass Complexi d maintainabili he software de ever a better nsider the inter attributes in a cepts of O loading and Po

GED WEIGHT EASURE (Cw)

xity can not b program/softwa ttribute of so ontribute to e:

Level of State

ch is at deepe understand an herwise. We ta ssigning weigh evel/class) i.e in

which are at ose statements w

on.

ontrol Structur

s with more more complex nt control stru ogram/class d e

y, which is cal

ct oriented cod en by the sum

omplexity of a operation in mbers (Attrib l. Further, com lexity of the ll as on the N

imitations:

cludes the comp and attributes. ed Class Comp atisfies six pro easure as well, can be used t code with dif ty value ind ty of the code eveloper for be

Object Orien rnal structure class but it s OOP like In

olymorphism.

TED COMPL ) METRIC

be computed b are because oftware. The o complexity

ements in Clas

er level of inh nd thus contrib

ake effect of ht 0 to stateme n the base clas level 2 i.e fi which are in n

res:

e control str and vice-vers uctures contrib differently. For

lculated by

de, then the of weights

(2)

a class was n methods,

butes) and mplexity of e Code of

Number of

plexity due . By using, plexity has operties out , structured to calculate fferent size. icates that is difficult. etter design nted metric

of method should also Inheritance,

EXITY

by a single e it is

prominent y of a

sses:

heritance of butes more inheritance nts at level ss, weight 1 irst derived

ext derived

(5)

Stephen N. Waweru etal, International Journal of Advanced Research in Computer Science, 4 (8), May–June, 2013,51-62

© 2010, IJARCS All Rights Reserved 55

iterative control structures like for loop, while .. do, do .. while contribute more complexity than decision making control structures like if .. then .. else. Therefore, we assign different weights to different control structures.

C. Nesting of Control Structures:

A statement which is at the deeper most level of nesting ( the inner most level ) of control structures is harder to understand and thus contributes more complexity than otherwise. We also take effect of nesting of control structures by assigning weight 1 to statements at level one i.e. the outer most level, weight 2 for those statements which are at level 2 i.e. the next inner level of nesting and so on. The weight for sequential statements is taken as zero.

D. Size:

Size is also considered one of the parameter of program/class complexity. A class with more methods is harder to understand than a class with less number of methods and hence contributes more complexity [23]. Large programs incur problem just by virtue of volume of information that must be absorbed to understand the program and more resources have to be used in their maintenance. So, size is a factor which adds complexity to a program/class.

By taking these factors into account, a weighted complexity measure for an object-oriented program P was suggested as:

n

C

w

=

E

k

* (W

t

)

k ……. Equation 1

k=1

Where;

Cw - Improved Merged Weighted Complexity Measure [IMWCM] of Program P,

n - Total Number of Executable Statements in Program P,

Σ

- Summation Symbol,

* - Multiplication Symbol,

k - Index Variable,

(Wt)k - Total Weight of kth Executable Statements in Program

P,

ΣEk - Summation of kth Executable Statements in terms of

{Operators, Operands, Methods, Strings & Functions}.

Ek = Eo + Es + Em + Es + Ef ……….………….. (1)

Where;

Eo - Number of Operators in an Executable Statement [P]

Es - Number of Operands in an Executable Statement [P]

Em - Number of Methods in an Executable Statement [P]

Es - Number of Strings in an Executable Statement [P]

Ef - Number of Functions in an Executable Statement [P]

Wt = Wn + Wi + Wc ………. (2)

Where;

Wn = weight due to Nesting Level of Control Structures where it is; = 0 for sequential statements,

= 1 for statements inside the outer most level of control structures,

= 2 for statements inside the next inner level of control structures and so on.

Wi = weight due to Inheritance Level of Statements in classes where it is;

= 0 for statements inside the outer most level of inheritance i.e. inside base class,

= 1 for statements inside the next level of inheritance i.e. first derived class,

= 2 for statements inside the next deeper level of inheritance i.e. next derived class

and so on.

Wc = weight due to Types of Control Structures where it is; = 0 for sequential statements,

= 1 for decision making control statements like if .. then .. else,

= 2 for decision making control statements like while .. do, for loop, do .. while,

= n for switch statement with n cases.

IX. COMPARATIVE STUDY OF THE WEIGHTED COMPLEXITY MEASURE METRIC

In this section, the research paper adapts a ‘C’ program for analysis of the result then calculates the Cognitive Weight Complexity Measure (CWCM) for the program codes. Finally compares Cognitive Weight Complexity Measure with Cognitive Functional Size. The value of Cognitive weight complexity measure and cognitive functional size are given in the following respective tables below..

Table 6: Calculation of Metric Cw for Prog 1- [(S)j]

Statement Number Executable Statement (S)j

s1 void Abc::input() 4

s2 count<<“enter value” 3

s3 cin>>a>>b>>c 7

s4 void Abc::output() 4

s5 count<<“A=“<<a 5

s6 count<<“B=“<<b 5

s7 count<<“C=“<<c 5

Table 7: Calculation of Metric Cw for Prog 1 – [(Wt)j]

Statement Number

Executable Statement

Wa Wi Wc (Wt)j

s1 void Abc::input() 0 1 0 1

s2 count<<“enter value”

0 1 0 1

s3 cin>>a>>b>>c 0 1 0 1

s4 void Abc::output() 0 1 0 1

(6)

s6 void Ab

count<<

he table below ved when I u very low valu des a depend plete complexit herefore the mework based o

de software d led reports f plexity.

Table

Metric Tested

WMC

alculation of Metri

able

ED COMPLEX COMPUTAT

tements) theref

ED COMPLEX ANALYS

w shows that a h used MWCM c ues. This is a dable and reli ty details of a p proposed Sof on MWCM wil developers with

for determinin

e 9: Computation A

Experi

ic Cw for Program

j (Wt)j Cw

XITY MEASU TION

fore; Cw (P) =

XITY MEASU SIS

high complexi compared to o n indication t iable value th program code.

ftware Code ll be very accu

h the actual, ng their soft

Analysis Table

imentation for Pro

CBO MWCM

1 others which that MWCM hat provides

Complexity urate and will realistic and tware codes

gram 1 others feature licensin discus

Und tool fo This t (SciTo which for this

A.

Thi Java, F like PH system

Figure 5

. THIS RE

hus, we infer Complexity Me ealistic estimat

his is becaus Measure also ta actors not cons McCabe’s meas

hese factors ar heir nesting lev As a software lasses/program o calculate a

lasses/program oftware System

XIII. COM

e comparative d Weighted Co McCabe’s] , CK

erged Weighte ore sensitive velopers to fferences betw alstead’s assu

velopers, wh easure (Cw) ha

ose assumption C was not able f the similar cod

ANALYSIS AN OLS FOR SO

ANALYSIS

ere exist ma rement in the m +. Some of the are proprietary es, support fo ng prices and and analyses U

XV. U

derstand is a r maintaining, tool is devel

ols). This tool extent this too s project.

Language Supp

is tool can an FORTRAN an HP. OS suppor ms including So

5: Computation An

ESEARCH PA

that, the prop easure detects es.

se the Merged akes into accou

sidered earlier sure.

re size, types o vel.

e system is ms, so the propo

and compare ms and henc

ms

PARATIVE I

inspection of omplexity Mea K metrics and H ed Complexity M

measurement, differentiate een codes. umptions ma

ereas Merged as the least am ns are based on e to make sens des had the sam

ND FINDING OFTWARE CO

AND MEASU

any tools fo market, for exa

em are freewar y tools. They d or languages, d other aspec Understand.

UNDERSTAN

commercially measuring an loped by Sci l is thoroughly ol meets with t

port:

nalyze 14 lang nd some web rt. It is availabl olaris.

nalysis Chart

APER FINDIN

posed Merged s complexity

d Weighted C unt the comple r Metrics suite

of control stru

developed in osed measure c e the compl ce of Obje

INSPECTION

f the impleme asure (Cw) ver

Halstead has sho Measure (Cw)

so that it w even small

ay sometimes d Weighted C mount of assum

n cognitive asp sitive measurem me CC values.

GS OF THE EX ODE COMPL UREMENT [4

or code ana ample QA-C an re and open-so differ a great d support for cts. This resea

ND TOOL

available stat nd analyzing so

ientific Toolw y evaluated to the specific re

guages includi programming le for all majo

NGS

d Weighted and gives

Complexity exity due to , LOC and

uctures, and

terms of can be used lexities of ect-oriented

N

entation of rsus eLOC,

own that: shall make will enable

complexity

s mislead Complexity mptions and

ects. ment; most

XISTING LEXITY

46]

alysis and nd Testwell ource while deal in their platforms, arch paper

tic analysis ource code. works Inc. o see up to equirements

(7)

Stephen N. Waweru etal, International Journal of Advanced Research in Computer Science, 4 (8), May–June, 2013,51-62

© 2010, IJARCS All Rights Reserved 57 B. Metrics:

It can gather large number of metrics including many basic metrics, some advance metrics and some custom metrics. During the evaluation of this tool it is found that some of the commonly used metrics aren't included in this tool, for example is it missing all Halstead metrics. It is also observed that all metrics aren’t available for all the languages the tool can analyzed. However it can gather about 74 metrics and most of the metrics are available for C/C++.

C. Features:

It is a GUI tool for all operating systems this tool supports. It outputs reports in graphical, textual and HTML format. It comes with a programming editor. It has a code check feature that checks the code for coding standards. The coding standards it has for code check are Effective C++ (3rd Edition), MISRA-C 2004 and MISRA-C++ 2008. A very nice feature of this tool is the plug-in support which allows users to define and add new metrics to the functionality.

D. Critical Analysis:

This tool is more useful for the developers than the management. It has features like code check and code editor that aren't generally needed for the management. Although this tool can gather large variety of metrics but it doesn't provide any recommended maximum and minimum values for the metrics. The feature of comparison among various releases of software is also not a part of this tool. Project is created manually and since it has the GUI interface it is maybe hard to automate it. Manually created projects with an in-built feature of code editing allow for unwanted changes to the code and lead to the problems of code security and safety. It has no in-built support for integration with any code repository; therefore code has to be available locally before the analysis can perform. During the analysis on actual code it produced some strange results. Value of 4576376.0000 is calculated for a metric “CountPath” when this tool was analyzing a package "Test". This value is way too strange and with no recommended maximum or minimum guidance, it even becomes more confusing.

XVI. EVALUATION SUMMARY OF ALL TOOLS

The tools evaluation proved that functionality wise the tools differ greatly. Some of the tools try to do too much, from complexity measurements to coding standard checks, from function level to project level, from bug detection to bug prevention and some provide code editing facility as well. On the other side, some tools keep their focus on complexity measurements only with either small or large number of metrics. Language support also varies among tools. Some tools support multiple languages at the same time while others are one language specific tools. Some tools work as standalone but some has integration features with IDE's. Visual Studio has its own complexity measurement feature in it. LOC or its variants and McCabe Cyclomatic complexity are the most common metrics for every tool. The way of creating code analysis reports is also

different in most tools. Most of the tools are designed to help software developers, especially those tools that can be integrated with IDE's and gather large number of metrics.

XVII. PROPOSED SOFTWARE CODE COMPLEXITY FRAMEWORK TOOL BASED ON A MERGED WEIGHTED COMPLEXITY MEASURE METRIC

Among all the tools analyzed in this research paper there were no tools that adapted or used Cognitive Informatics metrics. Therefore this shows that there is a big gap and a great need for a new Software Code Complexity Analysis And Measurement Tool that adapts or is based on Cognitive Weights and Informatics for greater comprehensibility of software codes and entire complete programs at large out there in the market.

Software Code Complexity Framework will provide a way to check your code using;

a. The Improved Metric [Merged Weighted Complexity Measure Cw]

b. Published Coding Standards c. And Custom Standards.

These Checks can be used to verify Naming Guidelines, Metric Requirements, Published Best Practices, or any other Rules or Conventions that are important. Complexity Measurement and Analysis is a process where key figures are derived from existing source code. These key figures then serve as indicators to judge a source code’s quality. Obtaining key figures is accomplished by certain arithmetic’s directly applied to the source code. In General, arithmetics that are applied in complexity measurements are called Metrics. They make up a set of formulae that is provided by code metrics tools. Software Code Complexity Framework [Software Code Complexity Framework] is tool dedicated to measure the complexity of source code written in C, C++ .

A. Published Coding Standards [40]:

You will find many "checks" straight from the following published standards:

i. Effective C++ (3rd Edition) Scott Meyers ii. MISRA-C 2004

iii. MISRA-C++ 2008

B. Software Code Complexity Framework Metrics:

Software Code Complexity Framework is very efficient at collecting metrics about the code it analyzes. These metrics can be extracted automatically via command line calls, viewed graphically, dynamically explored in the GUI, or customized via the Software Code Complexity Framework Java - NetBeans API. They can also be reported at the Project Level, for Files, Classes, Functions or User Defined Architectures. Most of the metrics in Software Code Complexity Framework - can be categorized in the following;

i. Improved Metric [Merged Weighted Complexity Metric Cw]

(8)

iv. O C

C.

Th Code due to

a. Inact

API N Descr

Metr C/C+ Java

a)

SU of fun

b.

API N Descr

a)

C/C+ Java

Fo below

Class

DualP

publi

//Pub BoatC

virtu static bool m

prote void t

char*

friend static static retur

}

priva int m

};

Object Orient Classes)

Software Cod

here are other Complexity F o space I have

Average tive):

Name :A

ription :A ne in

ric can be used ++ : Project, F

: Project, F

Applicable

UM (AltCount nctions

Number of

Name :C

ription :N

Metric can

++ : C

: C

or example if w w, the CountCl

s BoatCar priv

Purpose{

ic:

lic Instance Fu Car():Car(4),B

al int passenge

c int numRegis minWater//Pub

ected:

toggleinWater *mColor;//Prot

d void init(){}

c int sRegistere

c double calcSp

rn distance/tim

ate:

mMaxPassenger

void travel

ted (e.g. Co

de Complexity Fr

r metrics APIs Framework for

discussed just

Number of

AltAvgLineBla Average numbe ested functions nactive regions

d for

File, Class, Str File, Class, Inte

e Formula:

tLineBlank of

f Immediate B

CountClassBas Number Of Imm

n be used for:

Class,Struct,U Class,Interface we are provide assBase metric

vate Car public

unction oat(),minWate ers()const{retu

stered(){return

blic Instance V

(bool inWater) tected instance

ed;

peed(double d me;

rs; l(){}

oupling Betw

ramework Metr

s provided for Complexity A three.

Blank Line

ank

er of blank line s or methods, in

.

ruct, Union erface

each function

Base Classes:

se

mediate Base C

nion e

ed with the pro cs computes as

c Boat protecte

er(false),mColo

urn 4;}

n sRegistered;} Variable

){minWater=in e Variable

distance,double

ween Object

rics Api’s:

in Software Analyses, but

es (Include

es for all ncluding

in scope) / #

Classes.

ogram codes s follows;

ed

or(“Blue”){}

}

nWater;}

e time){

c.

API N Descri

inherita

a)

C/C++ Java MaxIn Frame

Table 12

McCabe v(G)

Lines of LOCph

Figure 4: A

Results for

Depth of Inh

ame : M

ption : Th ance

hier nod the DIT the incr

Metric can b

+ : Pr

: Pr

nheritanceTre ework Compu

Figure 7: S

2: Other metrics pr f

e’s Cyclomatic Co Complexity of control flow f Code

y Physical lin code

A Class Vehicle Flo

r class BoatCar

heritance Tree

MaxInheritanceT he depth of a c

rarchy is the m des from the cl

inheritance tre T of 0. The dee more methods reasing its com

be used for:

roject,Class,Str roject,File,Clas

e Software Co tation:

Showing Depth of I

rovided in Softwar for Complexity An

omplexity H f a programs B

D nes of source E

owchart Diagram

= 3 classes

e:

Tree

class within the

maximum numb ass node to the ee. The root no eper within the s the class can mplexity.

ruct,Union ss,Interface,Me

ode Complexit

Inheritance Tree

re Code Complexit nalyses

Halstead Estimated bugs Difficulty Effort to i

e

ber of e root of ode has a e hierarchy,

inherit,

ethod

ty

ty Framework

d number of

(9)

© 20

010, IJARCS All R pro Program l

code (com com Program l codes (pro bl Blank lin

code tainability Indexe

Maintainabil

oc Maintainabil without comm Maintainabil weighted com

III. SOFTW AMEWORK F

Software Co ser:

he Dependenc res:

a. Rapid bro Software architectur b. List "depe files and ar c. Spreadshee d. A Depend dependenc

Software Cod

o calculate dep ftware Code C

up dependen tecture. This in eferences that c ntly available f

Software Co uages:

he following uage versions a

e Complexity F

C/C++: Softw analyzes K&R constructs of Complexity Fr and has been te hat C++ templ

Java: Software JDK.

hen N. Waweru e

Rights Reserved lines of source mments)

lines of source ogram code} nes of source

es ity index

ity index ments

ity index with mments

WARE CODE FUNCTIONA INTERFA

ode Complexity

cy Analysis

owsing of dep Code C res

ndent", and "d rchitectures et export of dep dency Browsi cy information

de Complexity Fr

pendency we e Complexity Fra ncy data struc ncludes the nat caused the dep for quick explo

ode Complexi

list provides and/or compile

Framework]: ware Code R or ANSI C the C++ la ramework wor ested with mos lates are not ye e Code Compl

etal, Internationa

E COMPLEX AL GRAPHIC ACE

y Framework

capability pro

pendencies fo Complexity

dependent on"

pendency relat ing dock that

ramework Refer

examine every amework proje ctures for eve ture of the dep

endency. All o oration and bro

ity Framework

a brief overv ers supported b

Complexity C source code

anguage. Soft rks with any st of the popula et supported.

lexity Framew

al Journal of Adv

m Level

m Length

r of Operators

lary size r of unique ors

r of Unique ds

implementation n Algorithm e)

XITY CAL USER

Dependency

ovides these

or files and Framework

entities, for

tionships t shows all

rences:

reference in ect. We then ery file and

endency and of this data is

wsing.

k Supported

view of the by [Software

Framework e and most ftware Code

C compiler, ar ones. Note

ork supports

vanced Research i

Figure

D.

By and Ja lexical breaks So, for

foreach

you called " Add fields.

"identif

but you

E.

The remem syntax compli

Examp

String: Identifi Comm test thi

XIX

Sof variety vary ba into the

a.

in Computer Scie

8: Showing Softw

Search Index:

default Instant ava it breaks conventions o it up using wh instance, in th

h (i=1,i<10,i++

u could look f "search terms" ditionally, Inst These field

ifier". By defa u can limit sear

Software Code

e simplest is to mbering that AL is richer th icated queries.

ples:

test fier: test

ent: test s

X. SOFTW FRAMEWOR

ftware Code Co y of reports. Th

ased off of the ese categories:

Cross-Refer

to that in th are shown to

Structure r

analyzed pro

Quality repo

to be examin

Metrics rep

number of li

Calculated Met

Total Files ( Total Lines Code Lines Comment Li Whitespace Average Lin Comment Li Code/Comm Code/White Code/(Comm

ence, 4 (8), May–J

ware Code Complex Dialogue Box

t Search looks up the code of the languag hite space and p his line:

+)

for "foreach",

.

tant Search div ds are "strin

ault it searche rches to a parti

Complexity Fra

o type the term LL searching i han that, perm

- searches fo - searches fo - searches fo in them - matches an

WARE CODE RK GENERA

omplexity Fram he reports avail

e project langu

rence reports s he Info Browse ogether in alph

reports show ogram.

orts show area ned.

ports show ba ines of code an

trics For Conten

(For multiple fi

ines Lines ne Length

ines/File (For m ments Ratio

space Ratio ments + White

June, 2013,51-62

xity Framework In x

at all your cod following syn ge. For other la

punctuation.

, i, 1, and 10.

vides search ter

ing", "comm

s among all th icular field.

amework Search

m you are sea is case sensitiv mitting some

r "text" only in r identifiers na for comments

nything test OR

COMPLEXIT ATED REPOR

mework genera lable in your p uage, but the r

show informat er, except that habetic order. w the structur

as where code m

asic metrics su nd comments.

nts I:

ile metrics)

multiple file m

space) Ratio

59 nstant Search

de. For C++ ntactic and anguages it

These are

rms up into

ment", and hree fields,

h Syntax:

arching for, ve: But the relatively

n "strings" amed test

with "test"

R this

TY RTS

ates a wide project may reports fall

tion similar all entities

re of the

might need

uch as the

(10)

B.

Figure

Repo

Figure

X

So graph as we and to the w team impro Comp inspe

Report [1] Ca

e 9: Software Code

ort [2] For Cal

e10: Software Cod

XX. SOFTW FRAMEWO

oftware Code hical user inter ell as quality an

o contribute ea way metrics ar and not jus oving the q plexity Fram ction with on

alculated Metrics

e Complexity Fram shot

lculated Metri

de Complexity Fram shot

WARE CODE ORK RICH GR

INTERFA

e Complexity rface that enab nd test enginee asier to source re understood st by single quality of so

ework perfor ne mouse-clic

s Content I:

mework Output Re

ics Content I

mework Output R

E COMPLEX RAPHICAL U ACE

Framework bles managers ers to collabor code quality. I by an entire d

individuals oftware. Soft rms static s ck, and provi

eport 1 - screen

eport 2 - screen

XITY USER

provides a s, developers rate easier on It accelerates development involved in tware Code

ource code ides various

views t user in The ov various system automa pointin standar [Softw C/C++

A.

Sof with S metrics regarde Softwa values interpre (Scope is not o also do code it

B.

The Framew main a Figure user in before

a. T op vi b. T

M c. T

M m d. T

C

C. Option

File >N

Clic N to s Snapsh File >N

Clic N to se This S Explor that it h analysi

File > N

Clic to set u (latest,

that visualize nterface with h verall statistics s search and ms tool that

atically verify ng out any cod rd rules. Sof

are Code Com and Java softw

Software Code

ftware Code C Scopes. The co s value that is ed relative to re Code Com in a particular eting the valu ) it was measu only to avoid m one to cope w

self with its hie

Software Code

e Main Men work is divid areas are dedica 8 shows these nterface of So they are descri he Main Me perations like iews or create r

he Projects E Metrics Projects he view area f Metrics View, metrics graphica he Command Code Complexit

Software Code Group:

New > Metric

ck New then c set up a new hots of analyses New > Snapsh

ck New then c et up a new Sn Snapshot will rer implicating

holds the latest is.

New > Report

ck New then c up a new PDF

marked bold)

the analysis re hypertext links is presented in filtering optio performs sta ying source de lines that b ftware Code mplexity Framew

ware projects.

Complexity Fra

Complexity Fra oncept of a S

calculated fro o a context ( mplexity Frame

r context (Scop ues’ meaning o

ured in. Measu misinterpretatio with the severa

erarchical struc

Complexity Fra

nu of Softw ded into four ated to accomp e four main ar oftware Code ibed in more d nu and the open/save M reports. Explorer, to s, Snapshots or for the two vie to examine t ally or precisel History, where ty Framework

e Complexity

cs Project

click on Metric Metrics Proje s results later o

hot

click on Snapsh napshot for an

be marked b that it is the la t metrics value

t > PDF Repor

click on Repor F report of the ) of the curren

esults in a rich s for ease of n list and chart ons. It is an andard code

code compli breaks any of Complexity F work] Provide

amework Scope

amework stron Scope implies om source code

(Scope). This ework measur pe), there is n other than by uring in particu

on of metrics v al levels (Scop cture implies.

amework Main M

ware Code C main areas. T plish different

reas within the Complexity F etail.

Quick Menu, Metrics Projec

manage item r Source Files. ews Dashboard

the different ly.

e commands o are logged.

Framework M

cs Project or p ect that will on.

hot or press C existing Metri bold within th atest in time wh es of the latest

rt

rt, then click P e current Main t Main Projec

h graphical navigation. t form with embedded checking, iance, and

the coding Framework es checks in

es:

ngly works that every e has to be means, if res metrics o room for

its context ular Scopes values, it is pes) source

Menu:

Complexity These four

tasks each. e graphical Framework

for basic cts, switch s like the

d View and scopes for

of Software

Main Menu

ress Ctrl + contain all

Ctrl + Alt + ics Project. he Projects hich means complexity

(11)

© 20 File >

C

File >

C

File >

C disc.

File >

C Metri Metri File >

C prede or pre

File >

C desire

File >

C

010, IJARCS All R

show up allo mize your repo > New > Repo

lick New... th rt to set up a shot (latest, m XML report is mework.

> New > Repo

lick New then t up a new CS st, marked bold rt is generat mework. It allow

software like M > New > Repo

lick New then et up a new shot (latest, m

plain text re plexity Framew

r. efined Project L

ess Ctrl + S.

Software Co :

he Quick Men uently needed o ter understandi

Figure 13: Softw

Software Co ns:

Open: Click O from disc.

Save: Click Sa your predefined

hen N. Waweru e

Rights Reserved

owing you to ort.

rt > XML Rep

hen click on a new XML re marked bold) of s generated by

rt > CSV Rep

click on Repo SV report of t d) of the curren

ted by Soft ws you to expo

Microsoft Exce rt > Text Rep

click on Repo plain text rep arked bold) of eport is gene work. You ca

load an exist

nt Solution ecent Project You can choos

total.

save the curren Location (also

to save the cu

it Software Co

ode Complexity

nu gives you a operations. Fig ing.

ware Code Complex

ode Complexity

Open to load a

ave to save the d Project Loca

etal, Internationa

o set further

port

Report, then eport of the c f the current m

Software Code

port

ort, then click the current Ma nt main projec ftware Code

ort metrics data el.

nt Metrics Pro called Workin

urrent Metrics

ode Complexity

y Framework

a quick access gure 9 shows th

xity Framew Quic

y Framework

an existing Me

current Metric ation.

al Journal of Adv

options to

click XML current Main main project.

e Complexity

CSV Report ain Snapshot ct. This CSV Complexity a into spread

Text Report urrent Main Main Project. ftware Code

ith any text

Project from

cently saved cently saved

oject to your ng Directory)

Project to a

y Framework

Quick Menu

s to a set of his menu for

ck Menu

Quick Menu

trics Project

cs Project to

vanced Research i

factors practic those f and em deficien as foll detailed the sco the sou has som advanta the lite aspects

in Computer Scie

ashboard: Swi etrics graphica

Metrics:Switch ecisely.

Software Co Reports: DF: Generate napshot.

ML: Generate napshot.

SV: Generate napshot.

XT: Generate napshot.

I. SOFTW FRAMEW

hrough the I omplexity Fram

tbeans IDE. he software cod ill be automa stallation of t de complexity he software cod

n be accessed i mplexity fram de complexity lly integrated i

CONCLU

Future Work:

rther research and simplify al. Although t factors, it is po mpirical valid

ncies about the ows: Consid d makes the fore, simplifica

of further rese a very low val s of cohesion m se the complex ents and inde ive complexity ope of this the urce of further r

me weaknesse ages, it can be erature in this f s with function

ence, 4 (8), May–J

itch to the Das lly.

to the Metrics

ode Complexi

a PDF report

an XML repo

a CSV report

a text report

WARE CODE WORK INST

Integration pa mework becom

de complexity atically availa the netbeans framework. de complexity in 2 ways i.e. t mework menu y framework b n the netbeans

USION AND F

is required t y the metric s the study has ossible to add dation of the

e metric were a dering the com e measureme ation may be o earch. Usually lue, as if it is may be improv xity value in a entation may y, but those fac sis research. T research. Altho s as noted abo e considered a field, since com nal aspect is a n

June, 2013,51-62

shboard View

View to exam

ity Framewo

t from the cu

ort from the cu

t from the cu

from the cur

COMPLEXIT TALLATION

ackage, Softw mes an integral

y framework fu able within th Integration fo

y framework fu through the sof or through th buttons. Both o

IDE.

FUTURE WO

to add more so that it beco

tried to includ more. After th proposed me also realized an mplexity so br ent difficult one of the mo

, the weight o not of much i ved so that thos

more significa be important ctors were exc These deficienc

ough the impro ove, because o a valuable cont mbining severa new attempt in

61

to examine

mine metrics

ork Quick

unctionality he IDE at or software

unctionality ftware code he software

options are

ORK

complexity omes more de most of he research etric, some

nd they are roadly and

(12)

XXIII. CONCLUSION

The outcome of the Framework developed from the improved merged weighted complexity metric shows that; The tool is capable of performing code analysis automatically on regular basis. It proves that the automatic measurement of source code complexity is possible to implement. The tool is helpful for developers to view the quality of their code in terms of code metrics. Potentially fault-prone code can easily be identified which can suggest developers about the code that requires refactoring. The change of code may also help the testers to focus their testing efforts on those parts of code that are changed. The automatic logging feature will allow for real-time monitoring of the tool. The configuration interface shall allow for simple addition/alteration of configuration specification. As complexity and code size grow for each year, so does the problem of releasing high-quality software. An Improved Weighted Composite Complexity Measure has been used which takes into account different aspects of complexity: size, control structures, their nesting and inheritance level of statements in classes. The research paper shows that the effect of these structures on complexity is quite significant. It is a robust method because it encompasses all major parameters and attributes that are required to find out complexity.

XXIV. REFERENCES

[1] R. Caves, Multinational Enterprise and Economic Analysis, Cambridge University Press, Cambridge, 1982.

[2] M. Clerc, “The Swarm and the Queen: Towards a Deterministic and Adaptive Particle Swarm Optimization,” In Proceedings of the IEEE Congress on Evolutionary Computation (CEC), pp. 1951-1957, 1999.

[3] H.H. Crokell, “Specialization and International Competitiveness,” in Managing the Multinational Subsidiary, H. Etemad and L. S, Sulude (eds.), Croom-Helm, London, 1986.

[4] K. Deb, S. Agrawal, A. Pratab, T. Meyarivan, “A Fast Elitist Non-dominated Sorting Genetic Algorithms for Multiobjective Optimization: NSGA II,” KanGAL report 200001, Indian Institute of Technology, Kanpur, India, 2000. [5] J. Geralds, "Sega Ends Production of Dreamcast,"

vnunet.com, para. 2, Jan. 31, 2001.The Mythical man Month: Essays on Software Engineering. Addison. Wesley, 2012.

[6] IEEE Std. 1061-1998 −IEEE Computer Society: Standard for Software Quality Metrics Methodology, 1998.

[7] Basili, V.: Qualitative Software Complexity Models:A summary, In tutorial on Models and Methods for Software Management and Engineering. IEEE Computer Society Press. Los Alamitos, CA 1980.

[8] Zuse, H. : Software Complexity Measures and Methods, W. de Gruyter, New York. 1991.

[9] Curtis, B.: Measurement and Experimentation in Software Engineering. Proc IEEE conference, 68.9. 1144-1157, September 1980.

[10] Sellers, B. H.: Object Oriented Metrics: Measures of Complexity, Prentice Hall, New Jersey, 1996.

[11] McCabe. T.H.(1976),A complexity measure. IEEE Transactions Software Engineering, (SE-2,6):308-320.

[12] Halstead. M.H.(1997), Elements of software science, Elsevier North-Holland,New York

[13] Oviedo, E.I. (1980). Control flow, data and program complexity. Proc. IEEE COMPSAC, Chicago, IL, pages 146-152.

[14] Basili. V.R.,(1980), Qualitative software complexity models: A summary in tutorial on models and methods for software management and engineering. IEEE Computer Society Press, Los Alamitos,CA.

[15] Wang. Y. and Shao J. (2003). A new measure of software complexity based on cognitive weights, Can.J.Elect. Comput. Eng.,28,2,69-74.

[16] Woodward, M. R., Hennel. M. A., David. H.,( 1979) A measure of control flow complexity in program text. IEEE Transaction on Software Engineering, SE-5, Vol. 1, pages 45-50.

[17] Baker, A.L., and Zweben, S.H. (1980), A comparison of Measures of control flow Complexity, IEEE Transaction on Software Engineering, 6, 506-511.

[18] Weyuker. E.J.,(1988), Evaluating software complexity measure. IEEE Transaction on Software Complexity Measure, 14(9): 1357-1365.

Figure

Table 1 and figgure 2 below,
Table 7: Calculation of Metric Cw for Prog 1 – [(Wt)j]
Table 8: Caalculation of Metri
Figure 8: Showing Softwware Code ComplexDialogue Boxxity Framework Inx nstant Search
+3

References

Related documents

clinical studies have shown that patients with atherosclerosis- related diabetes, aneurysm and chronic kidney disease had increased levels of serum cathepsins S or L.. 15,22,23

Patients with both ER in the inferior leads and horizontal/de- scending ST variant and myocardial scar had an increased age and gender adjusted HR of cardiac events (HR: 10; 95%

Multivariate regression analysis showed that Model for End-Stage Liver Disease (MELD) and systemic inflammatory response syndrome (SIRS) scores were significant predic- tive

At the opening ceremony of Landsmót 2012, our case study event, spectators were welcomed with the greeting “Dear international guests and friends of the Icelandic horse”,

The single- wavelength neural network used 35 separate networks, each one predicting a single output corresponding to one of the 35 wavelengths for the reflectance factors;

7 Video analysis has been utilised in rugby union to study injury mechanisms in tackle contact situations 8 – 10 and speci fi cally for concussion in sports such as American football

Representationally these initiatives operate at different geographical scales from: efforts to inter- vene in the industrial use of a reservoir system and to rescale its use to