10
Mock-up exam 2IMP25 Software evolution This is a closed-book exam. No books, lecture notes, slides or any auxiliary material is allowed. The exam consists of five questions; you should answer four of them. Should you decide to answer all five questions, only the first four questions will be graded. When answering questions try to be brief but complete.

Mock up exam 2IMP25 Software evolution - TU/easerebre/2IMP25/2015-2016/MockUp exam.pdf · Mock-up exam 2IMP25 Software evolution This is a closed-book exam. No books, lecture notes,

  • Upload
    lykhanh

  • View
    231

  • Download
    1

Embed Size (px)

Citation preview

Mock-upexam2IMP25SoftwareevolutionThisisaclosed-bookexam.Nobooks,lecturenotes,slidesoranyauxiliarymaterialisallowed.Theexamconsistsoffivequestions;youshouldanswerfourofthem.Shouldyoudecidetoanswerallfivequestions,onlythefirstfourquestionswillbegraded.Whenansweringquestionstrytobebriefbutcomplete.

1. Softwaremetrics.a. (5)Giveadefinitionofcyclomaticcomplexity.Giveasmall

exampletoillustratethedefinition.b. (10)IntheoriginalpaperbyChidamberandKemererLCOM(C)

hasbeendefinedasP-QifP>Qand0,otherwise;wherePisthenumberofpairsofdistinctmethodsintheclassCthatdonotshareinstancevariables,andQisthenumberofpairsofdistinctmethodsintheclassCthatshareinstancevariables.

i. (2)Identifytheshortcomingsofthisdefinition.ii. (4)Proposeanalternativethatdoesnotsufferfromthe

shortcomingsidentified.iii. (4)Illustratethedifferencebetweentheoriginaldefinition

andtheoneproposedin1-b-iibymeansofanexample.c. (10)ThefollowingfigurefromBusingeetal.showsthemeanand

thestandarddeviationofthenormalizeddistancefromthemainsequenceDnoveranumberofrevisionsofPyDev.DescribetheevolutionofPyDevusingthisfigure.HereIwouldexpectthatyoutoatleastmakethefollowingobservationsandinterpretthem:

• Themeanislowerthanthestandarddeviation.ExplainwhatthiswouldmeanandhowwouldthisberelatedtothehistogramsofDndistributionyouhaveseenintheclass.

• Combinethepreviousobservationwiththerangeofthevaluesobserved(0.15-0.19).Whatwouldthismeanintermsofthe“mainsequence”?

• Trends.Ingeneralstandarddeviationseemstodecrease,whilethemeanismoreorlessstablebetweenJanuary2007andAugust2009.Howwouldyouexplainthisobservation?

• Singularities.Forinstance,inJanuary2007themeanhasgreatlyincreasedandaroundSeptember2009itdecreasedwhilethestandarddeviationremainedmoreorlessthesame.Whatcouldhavecausedthis?

2. Codeduplication.

a. (5)DefinethenotionofType2clones.Giveasmallexampletoillustratethedefinition.

b. (10)Comparethetoken-basedapproachofBrendaBaker’sandtheAST-basedapproachofIraBaxteretal.Whataretheadvantagesandthedisadvantagesofeachoneoftheapproaches?

c. (10)ThefollowingfigurefromLivierietal.showscloningbetweendifferentversionsoftheLinuxkernel.Thefigureisaheat-mapwithlowervaluesbeing“cold”(blue)andhighervaluesbeing“hot”(red).Thevaluevisualizedrepresentsthecoverageofthesourcecodeoftwoversionsbycodeshared(cloned)betweenthosetwoversions;thehigherthevaluethemoresimilarthoseversionsare.ThefigurehasbeenobtainedusingD-CCFinder,thedistributedversionoftheCCFindertooldiscussedintheclass.PleaseignorecharactersA,BandC.

DescribeevolutionoftheLinuxkernelbasedonthisfigure.

3. Repositorymining.a. (5)Giveadefinitionofadistributedversioncontrolsystem.Name

atleasttwodistributedversioncontrolsystems.b. (10)WhilesomeversioncontrolsystemssuchasCVSrecord

informationperfile,someotherssuchasSubversionrecorditpercommit.Whatareadvantages/disadvantagesofeachoneofthedecisions?

c. (10)ThefollowingfigurefromGîrbaetal.representstheownershipmapofJBoss(pleaseignorethecut-outpartintheleftuppercorner).DiscusstheevolutionoftheJBossdevelopers’communityandsystemorganizationbasedonthisfigure.

HereIwouldexpectyoutoobservethat(a)thecolor-mixchangeswiththetime,suggestingthatthedevelopers’teamcompositionhassignificantlychangedovertime(see,e.g.,appearanceanddisappearanceofthecyandeveloper),and(b)thechangesintheteamcompositionareaccompaniedbymanyfilesbeingadded(newlines)andremoved(linesstop)representingchangesinthesystemorganization---“newlords,newlaws”.

4. Architecturereconstructiona. (5)Theterm“reverseengineering”issometimesusedasa

synonymto“architecturereconstruction”.Explainthedifferencebetweenthetwotermsandgiveanexamplewhenoneofthetermsisapplicableandanotheroneisnot.

b. (10)ConsiderthefollowingexamplefromtheSoftwareMaintenancelecturenotesbyFranzWotawa,RoxaneKoitzandBirgitHofer.ConstructanObject-FlowGraphforthisexample.

Solution(pleaseignoretheannotations):

c. (10)Oneofthemajorproblemsrelatedtoanalysisofthe

reconstructedclassdiagramsisthelevelofdetail:automaticallyreconstructedclassdiagramscontainfartoomanydetailsforhumanstooversee.Presentatleasttwodifferenttechniquestotacklethisproblemanddiscusstheiradvantagesanddisadvantages.

5. Refactoring

a. (5)Giveadefinitionofrefactoringb. (10)Recalltheclassificationofrefactoringsbasedontheirimpact

ontheinterfaceasproposedbyMoonenetal.:compatible,backwardscompatible,canbemadebackwardscompatible,andincompatible.

i. (2*4)Foreachoneoftheclasses:giveanexampleofrefactoringbelongingtothisclass.Explainwhytherefactoringbelongstothisclass.

ii. (2)Furthermore,Moonenetal.haveidentifiedaseriesofsmellsinthetestcode,suchasTestrunwar(concurrentuseofresources)andMysteryguest(dependencyonanexternalresource).HowcanonerefactorthetestcodetoeliminatetheTestrunwarandMysteryguestsmells?

c. (10)Sokoletal.havestudiedtheimpactofrefactoringonsourcecodecomplexity,measuredintermsofthetotalcyclomaticcomplexityofaproject(CC).Theyhavedistinguishedbetween”documentedrefactorings”,i.e.,commitswithanassociatedmessagecontainingwordssuchas“refactoring”,“refactored”,“refactor”,andsoon;andremainingcommits.TheyhavestudiedJavaprojectsoftheApacheSoftwareFoundationandobservedthat1504documentedrefactoringsdecreasedcyclomaticcomplexity,1603didnotaffectitand3230increasedcyclomaticcomplexity.ThefollowingscatterplotshowsthepercentageofcommitsthatdecreasedCyclomaticComplexitybyeachproject’stotalcommitcount.Eachdotrepresentsaprojectandonlytheprojectswithdocumentedrefactoringswereconsidered.BasedonthisstudytheauthorsconcludethatnoevidencecanbefoundtosupportthepositiveeffectofrefactoringsontheCyclomaticComplexity.Whatkindofissuesmighthavethreatenedvalidityofthisconclusion?

Hereatleastthefollowingissuesshouldhavebeenmentioned:• Identificationof“documentedrefactorings”:theword

“refactoring”mightbemisusedbythedevelopers,e.g.,todenoteanykindofchange(“refactoredXXXtofixbugYYY”),makingtheapproachtoidentifyspuriousrefactorings,anddescriberefactoringswithoutusingtheword“refactoring”(“extractedmethodXXX”),makingtheapproachtomisstherefactorings.

• Codecommitsusuallyintegratemultiplechanges,someofthembeingrelatedtorefactoringandsomenotbeingrelatedtorefactoring,i.e.,attributingchangeinCCtorefactoringonlymightbepreposterous.

• Cyclomaticcomplexitymightnotbeanappropriatecomplexitymeasureforobject-orientedprograms;e.g.,itdoesnottakeinheritanceintoaccount.Moreover,getters/settersusuallyhavecyclomaticcomplexityofzero.

• ConclusionsfromtheApacheSoftwareFoundationsmightnotbegeneralizablebeyondtheprojectsofthisfoundation.Similarly,conclusionsfromtheJavaprojectsmightnotbegeneralizabletootherprogramminglanguages.

• Thedatasetshowshighvariance,i.e.,largedifferencesbetweendifferentprojects,i.e.,conclusionbasedonthecompletedatasetcannotbeappliedtoindividualprojects.