文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > Automating Feature-Oriented Refactoring of Legacy Applications
侵权投诉

Automating Feature-Oriented Refactoring of Legacy Applications

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

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email