Creating a software product line from a legacy application is a difficult task. We propose a tool that helps automating tedious tasks of refactoring legacy applications into features and frees the developer from the burden of performing laborious routine i
AutomatingFeature-OrientedRefactoringofLegacyApplications
ChristianK¨astner,MartinKuhlemann
DonBatory
SchoolofComputerScienceUniversityofMagdeburg{ckaestne,mkuhlema}@ovgu.de
Abstract
Creatingasoftwareproductlinefromalegacyappli-cationisadif culttask.Weproposeatoolthathelpsau-tomatingtedioustasksofrefactoringlegacyapplicationsintofeaturesandfreesthedeveloperfromtheburdenofperforminglaboriousroutineimplementations.
1.Introduction
Asoftwareproductline(SPL)aimsatcreatinghighlycon gurableprogramsfromasetoffeatures.Toreducecostsandrisks,developersoftentakeanextractiveapproachforcreatingtheSPLbyrefactoringanddecomposingoneormorelegacyapplicationsintofeatures[2].Inpriorcasestud-ies,wedetachedoptionalfeaturesliketransactions,statis-tics,orcachesfromdatabasesystems,andexperiencedthatrefactoringlegacyapplicationsmanuallyisacomplexanddif culttaskcontainingmanyroutineoperations[7].Whendecomposingalegacyapplicationintofeatures,thedevelopersfocusisonidentifyingthefeaturecode,i.e.,classes,methods, elds,orstatementsassociatedwithacer-tainfeature.Incontrast,theactualrefactoring,consistingofremovingcodefragmentsandreintroducingtheminfeaturemodules,isaroutinetaskthatcanbeautomatedwithatool.Previously,webuiltatoolcalledColoredIDEtoidentifyandmarkfeaturecodeinalegacyJavaapplication.Now,weusethismarkedcodebasetorefactoralegacyapplicationintoasoftwareproductlinewithmultiplefeatures.FeaturesinanSPLcanbeimplementedindifferentways.Currentresearchsuggeststoimplementfeaturesasmixinlayers[12]oraspects[5,8],butotherimplementationap-proachesarepossible.Intheprototypeofourtoolweinves-tigatedrefactoringsintofeaturemodulesimplementedwithJak[1]andAspectJ[8].InthispaperwefocusonAspectJastargetlanguageandassumeabasicknowledgeofit.
Dept.ofComputerSciencesUniversityofTexasatAustinbatory@cs.utexas.edu2.Refactoring
Theinputofourrefactoringtoolisalistoffeaturesandamarkedversionofthesourcecode,wherefragmentsareassociatedtothesefeatures.InFigure1weshowanex-ampleclassStackwithafeatureLockingwhosecodeisunderlined.Technically,featuresareassociatedtoelementsintheabstractsyntaxtree(AST)ofthesourcecode,e.g.,theASTnodeforthemethodlock(Line8)andthestate-mentsinLines3and5aremarkedwiththeLockingfeature(underlined).
1classStack{2voidpush(Objecto){3Locklock=lock(o);4o;5lock.unlock();6}78Locklock(Objecto){/.../}9}
Figure1.MarkedLegacyCode
OurtoolnowcreatesanewprojectfortheSPLwithdirectoriesforeveryfeatureandadirectoryforthebasecode.Thebasecodecontainstheoriginalprogramwithoutanyfeaturecode.Thefeaturedirectoriescontainaspectsthatreintroducethefeaturecode.InFigure2weshowtheresultingclassofthebasecodeandtheaspectimplementingtheLockingfeatureforourexample.TheSPLcannowbecon guredbyselectingthedirectoriestoincludeinthecompilationprocess.
FortheimplementationoftheAspectJrefactoringwefol-lowproposalsforrefactoringslikeExtractIntroduction[6],MoveFieldfromClasstoInter-type[10],orExtractAd-vice[6].
3.AdvancedTopics
Generally,ourtoolusesmoresophisticatedrewritesthanshownintheexampleabove.Forinstance,whenthefeature
Automating Feature-Orien... 暂无评价 2页 免费 Elements of Reuse and Re.... Object-oriented refactoring, legacy constraints and reuse Legacy constraints ...
Experience-Based Refactoring for Goal-Oriented Software Quality Improvement Abstract. In agile software development refactoring is an important phase for the ...
热门文档