您好,欢迎访问三七文档
Component-OrientedProgramminginObject-OrientedLanguagesPeterH.FrohlichandMichaelFranzDepartmentofInformationandComputerScienceUniversityofCalifornia,IrvineIrvine,CA92697-3425,USAFax:+1.949.824.4056phf@acm.org,franz@uci.eduAbstract.Currentapproachestocomponent-orientedprogrammingarebasedontraditionalobject-orientedlanguagesandconcepts.However,mostexistingobject-orientedlanguagesfailtoaddresssubtleinterfacecompatibilityissuesthatbecomeparamountinacomponent-basedset-ting.Weexplorebothsyntacticandsemanticinterfaceincompatibilitiesanddiscusswhytheyarediculttohandle.Wearguethatresolvingtheseincompatibilitiesrequiresbreakingwithafundamentalidiomofobject-orientedlanguages:thesubordinationofmessagestointerfacesandclasses.Weproposeasolutionbasedontheconceptofstand-alonemessagesasfoundintheexperimentalprogramminglanguageLagoonaanddiscussitsramications.1IntroductionComponent-orientedprogrammingaimstoreplacetraditionalmonolithicsoft-waresystemswithreusablesoftwarecomponentsandlayeredcomponentframe-works[27].Componentsextendthecapabilitiesofframeworks,whileframeworksprovideanexecutionenvironmentforcomponents.Botharedevelopedbyinde-pendentandmutuallyunawarevendors,andtheircompositionintoarunningsystemisperformedbyathirdparty,possiblytheend-user.Acomponent-basedapproachtosoftwaredevelopmentpromisesmanyad-vantages,almostallofwhichresultfromthepossibilityofvendorsspecializinginasingledomainofexpertise.Forexample,insteadofdevelopingacompletetextprocessingapplication,independentvendorscanconcentrateonprovidingdocumentversioning,spell-checking,hyphenation,orintelligentassistantswithinacommontextprocessingframework.Developmentresourcescanthusbecon-centratedonasinglecomponent(orasingleframework),hopefullyincreasingitsreliabilityandeciencybeyondwhatwouldbepossibleotherwise.Oneofthemostimportantfactorsformakingthevisionofpervasivesoftwarecomponentsarealityareinterfaces.Aninterfaceisanabstractionofallpossibleimplementationsthatcanllacertainroleinthecomposedsystem[18].Thisabstractionallowsustoconcentrateonwhatisrequiredofanimplementation2PeterH.Frohlich,MichaelFranztofulllitstaskandtodisregardirrelevantdetails.Inthecomponent-basedset-ting,interfacesareusedtodescribeboththeassumptionsthatframeworksmakeaboutcomponentsandtheassumptionsthatcomponentsmakeaboutframe-works.However,interfacesareusuallyonlysyntacticinnature,withbehavioralspecicationsgivenasinformalcomments.Inprogramminglanguages,type-checkingcanbeusedasanapproximation,butthisonlyguardsagainstasubsetoferrors[6,27].Moreelaboratetechniquesalsoexist,forexamplegreyboxspec-icationsintherenementcalculus[5].However,behavioralconformanceofanimplementationtoaninterfacecannotingeneralbeprovenautomatically.Inthispaper,wetakethepointofviewofcomponentvendorsasopposedtoframeworkvendors.Themajortaskofacomponentvendoristodevelopasoftwarecomponentthatconformstotheinterfacespeciedbyaframeworkven-dor.Thistaskismorecomplexwhencomponentshavetoconformtomultipleinterfaces,allspeciedbymutuallyunawareframeworkvendors.Forexample,aspecializedhyphenationcomponentforan\exoticlanguagewillonlybeinter-estingtoalimitedmarketsegment.Suchacomponentmightnotbeviableasaproductifitcannotbereusedacrossmultipletextprocessingframeworks.Object-orientedprogramminghasbeendescribedasafoundationtechnol-ogyforcomponents[27,29].Indeed,conventionalobject-orientedprogramminglanguageslikeJava[1]andC++[26]areoftenusedtoimplementsoftwarecom-ponents.Componentinterfaces,ontheotherhand,areusuallydescribedusinganinterfacedenitionlanguage(IDL).TheseIDLsarespecictoacertaincompo-nentmodelsuchasCOM[3,10]orCORBA[16],andalsohaveanobject-orientedcharacter.Theresultingcomplexityofthisapproachisdauntingandpromptedustoinvestigatesimpleralternatives[12,13].Inparticular,weareinterestedindesigningaprogramminglanguage|code-namedLagoona|thatprovidesonlywhatisessentialinacomponent-basedsetting,butnotmore.Arstinsightgainedfromthisprojectisthatmostcurrentobject-orientedlanguagesarebythemselvesunsuitableasabasisforcomponent-orientedpro-gramming.Theselanguagesfailtoproperlyaddresscertaininterfaceincompat-ibilitiesthatarisewhenacomponentmustimplementseveralinterfaces,eachdenedbyanindependentframeworkvendor.Futhermore,neitherthecompo-nentvendornorthecomposingend-usercanresolvetheseincompatibilitiesinastraightforwardway.Surprisingly,wecantracetheincompatibilityproblemsbacktoafundamentalidiomfoundinobject-orientedlanguages:thesubordina-tionofmessagestointerfacesandclasses.Ourconclusionisthatbreakingwiththisidiomistheonlycleanwaytosolvetheproblem.Theremainderofthispaperisorganizedasfollows.Section2illustratestheinterfacecompatibilityproblemsthroughaseriesofexamples.Section3analyzessyntacticandsemanticincompatibilitiesindetailandexplainstheirorigin.Sec-tion4introducestheconceptofstand-alonemessagesandshowshowitsolvesthecompatibilityproblemsintheLagoonaprogramminglanguage.Section5givesabriefoverviewofadditionalLagoonalanguagefeatures.Section6re-viewsrelatedworkandcomparesittoourapproach.Section7concludesthepaperwithasummaryofcontributionsandano
本文标题:Component-Oriented Programming in Object-Oriented
链接地址:https://www.777doc.com/doc-3620917 .html