计算机专业外文文献论文翻译1.docx

上传人:b****4 文档编号:11969135 上传时间:2023-04-16 格式:DOCX 页数:11 大小:25.07KB
下载 相关 举报
计算机专业外文文献论文翻译1.docx_第1页
第1页 / 共11页
计算机专业外文文献论文翻译1.docx_第2页
第2页 / 共11页
计算机专业外文文献论文翻译1.docx_第3页
第3页 / 共11页
计算机专业外文文献论文翻译1.docx_第4页
第4页 / 共11页
计算机专业外文文献论文翻译1.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

计算机专业外文文献论文翻译1.docx

《计算机专业外文文献论文翻译1.docx》由会员分享,可在线阅读,更多相关《计算机专业外文文献论文翻译1.docx(11页珍藏版)》请在冰豆网上搜索。

计算机专业外文文献论文翻译1.docx

计算机专业外文文献论文翻译1

外文文献:

 

EvolvingJavaWithoutChangingtheLanguage

In"TheFeelofJava"JamesGoslingstatedthat:

Javaisabluecollarlanguage.It'snotPhDthesismaterialbutalanguageforajob.JavafeelsveryfamiliartomanydifferentprogrammersbecauseIhadaverystrongtendencytopreferthingsthathadbeenusedalotoverthingsthatjustsoundedlikeagoodidea.

TheextraordinarysuccessofJavaoffersweighttothenotionthatthiswasasensibleapproach,andifitremainsanimportantgoalforJavatoday,thenitmakessensethatthelanguageshouldcontinuetoevolverelativelyslowly.Inadditiontothis,thefactthatJavaisamature,widelyusedlanguagecausesitsevolutiontobefraughtwithdifficulty.Foronething,eachfeatureaddedtothelanguagecanchangethewayitfeelsinsubtleandoftenunpredictableways,riskingalienatingdeveloperswhohavealreadyadopteditastheirlanguageofchoice.Foranother,afeaturethatmakesperfectsenseonitsownmayinteractwithotherfeaturesofthelanguageinawkwardorunexpectedways.Worse,oncealanguagefeaturehasbeenaddeditisallbutimpossibletoremoveevenifitturnsouttobedetrimentaltothelanguageasawhole.Tojustifyaddinganewfeature,alanguagedesignermustbehighlyconfidentthatitwillbeoflongtermbenefittothelanguageratherthanashorttermorfashionablesolutiontoaproblemthatrapidlybecomesredundant.Tomitigatetheriskalanguagedesignerwilltypicallyexperimentbycreatingaseparatelanguageorbranch,suchasthePizzalanguageusedtoexperimentwithJava'sgenerics,priortotheirimplementation.Theproblemwiththisapproachisthattheaudienceforsuchexperimentsisbothsmallandself-selecting;obviouslytheywillallbeinterestedinlanguagefeatures,andmanymaybeacademicsorresearchers.Anideawhichplayswelltosuchanaudiencemaystillplaybadlywhenitisincorporatedintothemainlanguageandgeneralprogrammersstarttoworkwithit.

Togetasenseofthis,considertheclosuresdebatethatbecamesoheatedforJava7.Implementationsforthemainproposals(andsomeothers)havebeenavailableforsometimebutnoconsensushasemerged.InconsequenceSundecidedthatJDK7willnotgetfullclosuressupport.ThecoreargumentcamedowntowhetherJavahadbecomeascomplexasitcouldaffordtobewhengenerics(andinparticularthewildcardsyntax)wereaddedtoJava5;andwhethertheadditionoffullsupportforclosureswasjustifiedwhenJavaalreadyhasamorelimitedformthroughanonymousinnerclasses.Twoimportantusecasesforaddingfullclosuressupportweretosimplifyworkingwiththefork/joinAPIthatisbeingaddedtoJDK7toimprovemulti-coreprogramming,andtohelpwithresourceclean-up.JoshBloch'sARMblockproposal,whichisnowexpectedtobeinJDK7viaProjectCoin,offersanalternativesolutiontothelatterproblem.Dr.CliffClick'sresearchonascalable,non-blockingprogrammingstyleforJavaoffersanalternativeapproachtofork/jointhatmaybemoreappropriateasthenumberofprocessorcoresincreases.Ifthisweretohappen,thentheusesforclosuresinJavamayarguablybetoolimitedtojustifytheirinclusion.

Itremainsimportantthoughthataprogramminglanguagecontinuestodevelopatsomelevel.ThisarticlethereforeexaminesthreealternativetechniquesforaddingnewlanguagefeaturestoJavathatdon'trequirechangestothelanguageitself-usingacustomDomainSpecificLanguage,exploitingtheJava6annotationprocessortoaddoptionallanguagefeaturesviaalibrary,andmovingthesyntacticsugarfromthelanguagetotheIDE.Eachoffersthepotentialtoallowawideaudienceofmainstreamdeveloperstoexperimentwiththenewfeaturesoverthemediumterminanon-invasivemanner,andthebestideascanthenfilterdownforinclusioninthecorelanguage.

CustomDSLs

ThemostwidelydiscussedofthethreeistheDomain-SpecificLanguageorDSL.Thereissomedisagreementonexactlywhatthetermmeans,butforthepurposesofthisdiscussionwe'llrefertoitsimplyasalanguagethathasbeencreatedwithanarrowfocustosolveaparticularproblem,ratherthanasageneralpurposelanguagedesignedtosolveeverycomputingproblem.AssuchwewouldexpectaDSLtobenon-Turingcompleteandforthemostpartthisisthecase.Thereareedgecasesofcourse.Postscript,forexample,isaTuringcompletelanguagebutalsoqualifiesasaDSLusingourdefinition.

Astheaboveexamplealsoillustrates,theideaofaDSLisnotnew.OtherfamiliarDSLsincludeRegularExpressions,XSLT,Ant,andJSP,allofwhichrequiresomesortofcustomparsertoprocessthem.MartinFowleralsosuggeststhatfluentinterfaces/APIscanbeconsideredasecondtypeofDSL,whichhereferstoasaninternalDSL.HisdefinitionisthataninternalDSLisdevelopeddirectlywithinthehostlanguage.ThiswasacommonpracticeamongstbothLispandSmalltalkprogrammers,andmorerecentlytheRubycommunityhasbeenpopularisingthetechnique.

Whilstmanywell-knownDSLsarecommerciallydevelopedandmaintained,someenterprisedevelopmentteamshaveusedthetechniquetocreatealanguagethatallowsthemtorapidlyexploreaspectsoftheirproblemdomain.Itisn'thoweverascommonasitmightbe,perhapsbecauseDSLshaveafairlyintimidatingbarriertoentry.Theteamhastodesignthelanguage,buildtheparserandpossiblyothertoolstosupporttheprogrammingteam,andtraineachnewdeveloperthatjoinstheteamonhowtheDSLworks.HeretheemergenceoftoolstospecificallysupportDSLdevelopmentcouldsignificantlychangethelandscape.IntentionalSoftware'sIntentionalDomainWorkbench,whichhasbeenindevelopmentlongerthanJavahasbeenaround,isthefirstsignificantimplementationofsuchatool.TheprojectstartedlifeatMicrosoftResearch,andDr.CharlesSimonyi's1995paper"TheDeathofComputerLanguages,theBirthofIntentionalProgramming"describeshisvision.In2002SimonyifoundedIntentionalSoftwaretocontinueworkingonhisideasandahugelyimpressivevideodemoofthesystemisavailable.Theproductitselfisat1.0status,butaccessisrestrictedtoverylimitedpartners.

Othersoftwarehousesarealsoexploringtheconcepts,amongstthemJetBrains,wellrespectedfortheirIntelliJIDEAJavaIDE,whohaverecentlyreleasedthe1.0versionoftheirMetaProgrammingSystem(MPS).MPSdoesn'tuseaparser,insteadworkingwiththeAbstractSyntaxTree(AST)directly.Itprovidesatext-likeprojectionaleditorwhichallowstheprogrammertomanipulatetheAST,andisusedtowritelanguagesandprograms.Foreachnodeinthetreeatextualprojectioniscreated-astheprogrammerworkswiththeprojection,thechangeisreflectedinthenode.Thisapproachallowsyoutoextendandembedlanguagesinanycombination(oftenreferredtoaslanguagecomposing)promotinglanguagere-use.JetBrainsareusingtheproductinternallyandhaverecentlyreleasedYouTrack,abugtrackingproductdevelopedusingthesystem.

TheJava6AnnotationProcessor

WhilstDSLsarelesscommoninmoremainstreamlanguagessuchasJavathantheyareinRuby,SmalltalkandLisp,recentdevelopmentsintheJavalanguage,inparticulartheannotationprocessorwhichwasaddedinJava6,offernewpossibilitiesfordeveloperslookingtousetheminJava.TheJPA2.0criteriaAPIthatwillshipaspartofJavaEE6,itselfaDSL,offersanexample.Heretheannotationprocessorbuildsupametamodeltypeforeachpersistentclassintheapplication.WhilstitwouldbeperfectlypossibleforthedevelopertohandcraftthemetamodelinJava,itwouldbebothtediousanderrorprone.Theuseoftheannotationprocessoreliminatesthatpainand,sincetheannotationprocessorisbuiltintoJava6,theapproachrequiresnospecificIDEsupport–anIDEdelegatestotheannotationprocessortriggeredbythecompiler,andthemetadatamodelisgeneratedonthefly.

Usingtheannotationprocessoritisalsopossibleforalibrarytoaddanewlanguagefeature.BruceChapman'sprototype"noclosures"proposal,forexample,usesthetechniquetoprovideamechanismforcastingamethodtoaSingleAbstractMethod(SAM)typewhichcompilesontopofJava6.DuringourconversationChapmanpointedoutthattheSAMtypealsosupportsfreevariables,akeyaspectofaclosure:

ThemethodbodycandeclareadditionalparametersbeyondthoserequiredfortheSingleAbstractMethodusingtheAs.Additionalannotation.TheseparameterscanhavevaluesboundtothematthepointwhereyouobtainaninstanceoftheSAMtype,andarethenpassedtothemethodeachtimeitisinvoked.

ChapmanalsosetuptheRaptprojecttoexploreotherusesofthetechnique,andhasaddedimplementationsfortwolanguagechanges-MultilineStringsandXMLliterals-thatwereconsideredforJDK7butwon'tnowmakeitintothefinalrelease.Javacouldevengetaformofclosuressupportusingthisapproach.Whenaskedaboutthis,Chapmansaid:

WearejustfinishingaSwingprojectwhichweuseditfor.Wehavefoundacoupleofminorbugsaroundgenerictypes,onerecentlydiscoveredremainstobefixedbutotherthanthatitseemsquitenicetouse,andnobodyhasbeenwantingtorushbacktouseconventionalanonymousinnerclasses.

ProjectLombok,anotherprojectexploringthetheannotationprocessor,pushesthetechniquestillfurther.IneffectLombokusesannotationprocessingasahooktorunaJavaagentthatre-writesvariousjavacinternalsbasedontheannotations.Sinceitismanipulatinginternalclassesitisprobablynotsuitedtoproductionuse(internalclassescanchangeevenbetweenminorreleasesoftheJVM)buttheprojectisaneye-openingexampleofjustwhatcanb

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1