计算机专业外文文献论文翻译1Word文档格式.docx

上传人:b****1 文档编号:4689438 上传时间:2023-05-03 格式:DOCX 页数:11 大小:25.07KB
下载 相关 举报
计算机专业外文文献论文翻译1Word文档格式.docx_第1页
第1页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第2页
第2页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第3页
第3页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第4页
第4页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第5页
第5页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第6页
第6页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第7页
第7页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第8页
第8页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第9页
第9页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第10页
第10页 / 共11页
计算机专业外文文献论文翻译1Word文档格式.docx_第11页
第11页 / 共11页
亲,该文档总共11页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

计算机专业外文文献论文翻译1Word文档格式.docx

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

计算机专业外文文献论文翻译1Word文档格式.docx

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-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2