Tải bản đầy đủ

OReilly beyond java sep 2005 ISBN 0596100949

BeyondJava
ByBruceA.Tate
...............................................
Publisher:O'Reilly
PubDate:September2005
ISBN:0-596-10094-9
Pages:200

TableofContents|Index

BruceTate,authoroftheJoltAward-winningBetter,Faster,LighterJavahasanintriguing
notionaboutthefutureofJava,andit'scausingsomeagitationamongJavadevelopers.
BrucebelievesJavaisabandoningitsbase,andconditionsareripeforanalternativeto
emerge.
InBeyondJava,Brucechroniclestheriseofthemostsuccessfullanguageofalltime,and
thenlaysout,inpainstakingdetail,thecompromisesthefoundershadtomaketo
establishsuccess.Then,hedescribesthecharacteristicsoflikelysuccessorstoJava.He
buildstoarapidandheadyclimax,presentingalternativelanguagesandframeworkswith
productivityandinnovationunmatchedinJava.Hecloseswithanevaluationofthemost
popularandimportantprogramminglanguages,andtheirfutureroleinaworldbeyond
Java.

Ifyouareagreewiththebook'spremise--thatJava'sreigniscomingtoanend--thenthis
bookwillhelpyoustarttobuildyourskillsaccordingly.Youcandownloadsomeofthe
frameworksdiscussedandlearnafewnewlanguages.Thisbookwillteachyouwhata
newlanguageneedstosucceed,sowhenthingsdochange,you'llbemoreprepared.And
evenifyouthinkJavaisheretostay,youcanusethebesttechniquesfromframeworks
introducedinthisbooktoimprovewhatyou'redoinginJavatoday.


BeyondJava
ByBruceA.Tate
...............................................
Publisher:O'Reilly
PubDate:September2005
ISBN:0-596-10094-9
Pages:200

TableofContents|Index

















































Copyright
Preface
WhoShouldReadThisBook?
Conventions
UsingCodeExamples
CommentsandQuestions
Safari®Enabled
Acknowledgments
Chapter1.OwlsandOstriches
Section1.1.IgnoranceasaVirtue
Section1.2.BoilingFrogs
Section1.3.NewHorizons
Section1.4.ThePremise
Chapter2.ThePerfectStorm
Section2.1.StormWarnings
Section2.2.TheC++Experience
Section2.3.CloudsOpen
Section2.4.FuryUnleashed
Section2.5.Aftermath
Section2.6.MovingAhead
Chapter3.CrownJewels
Section3.1.LanguageandJVMDesign
Section3.2.TheInternet
Section3.3.EnterpriseIntegration
Section3.4.Community





































































Section3.5.BreakingtheMyths
Chapter4.GlassBreaking
Section4.1.Java'sNewJobDescription
Section4.2.BasicJavaLimitations
Section4.3.Typing
Section4.4.Primitives
Section4.5.PartingShots
Section4.6.WhyNotJustFixJava?
Chapter5.RulesoftheGame
Section5.1.JavaRaisestheBar
Section5.2.EnterpriseIntegration
Section5.3.GeneratingtheBuzz
Section5.4.LanguageFeatures
Section5.5.AFewPotentialSuitors
Chapter6.RubyintheRough
Section6.1.AboutRuby
Section6.2.ApplyingSomeStructure
Section6.3.BreakingItDown
Chapter7.RubyonRails
Section7.1.TheNumbersGame
Section7.2.RailsbyExample
Section7.3.UndertheHood
Section7.4.TheEssence
Chapter8.ContinuationServers
Section8.1.TheProblem
Section8.2.Continuations
Section8.3.ContinuationServers
Section8.4.Seaside
Section8.5.ASeasideExample
Section8.6.SoWhat?
Chapter9.Contenders
Section9.1.ThePrimaryContenders
Section9.2.MinorContenders
Section9.3.TheNextBigThing
AbouttheAuthor
Colophon
Index


BeyondJava™
byBruceA.Tate
Copyright©2005O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles(safari.oreilly.com).Formoreinformation,contact
ourcorporate/institutionalsalesdepartment:(800)998-9938or
corporate@oreilly.com.
Editor:

MichaelLoukides

ProductionEditor:

DarrenKelly

CoverDesigner:

EllieVolckhausen

InteriorDesigner:

DavidFutato

PrintingHistory:



September2005:

FirstEdition.

NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
BeyondJava,theimageofabassaris,andrelatedtradedress
aretrademarksofO'ReillyMedia,Inc.


Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.
ISBN:0-596-10094-9
[M]


Preface
InMarchof2005,Iwasshockedandhonoredtogettheword
thatoneofmybooks,Better,Faster,LighterJava(O'Reilly),
wonaJoltawardfortechnicalexcellence.Italkedabouthow
Java?developerscouldbuckstandingconventionstobuild
betterapplications,fasterthanbefore.Thatbookwillalways
haveaspecialplaceinmyheart.Yet,throughouttheprocess,
somethingwasintheway,andIcouldn'tquiteputmyfingeron
it.
Aroundthistime,oneofmycustomerswasbuildingan
applicationconsistingofacomplexdatabaseschemawitha
web-baseduserinterface.We'dbeenusingSpringand
HibernatewithWebWork,acommonstackforlightweightJava
development,andwe'dbeengenerallypleased.Somethings
buggedus,though:theamountofrepetition,theproliferation
ofXMLconfiguration,andthepaceofourchanges.Onawhim,
wetriedRubyonRails,asurprisinglyproductiveandinnovative
frameworkthat'ssweepingquicklythroughnon-Java
communities,andismakingsomenoiseamongJavaarchitects,
too.Wewereshockedwithourproductivity,andwemovedthe
projecttothenewfoundation.
Somethingclickedintoplaceforme.Forthiskindofapplication,
Javaitselfwasintheway.Removeitfromtheequation,andI
couldreducetheamountofcodebyafactoroffour,drivethe
XMLdowntoone-tenthofwhatitwas,andachievestunning
productivity,withgoodperformance.Betterstill,theconceptsin
Better,Faster,LighterJavastillapplied.Forotherprojects,ifI
neededthecommunityandtoolsthatJavaoffered,Icoulduse
itinstead.IfIdidn'tneedJava,Icouldtaketheprinciplesin
BFLJtotheextreme.Adaminsidemebroke,andthisnewbook
startedpouringout.Ihadamessage.
Monthslater,Ifoundanaudience,thousandsofmilesand19


hoursfromhome.IfidgetednervouslybeforetheJavaUser's
Group.I'dcertainlyaddressedlargergroups,butthistripwas
different.Inthiscase,theNorwegianJavaUser'sGrouphad
paidmytravelexpensestoOslo,nottosingthepraisesof
Spring,orHibernate,oragiledevelopment,buttocalltheir
babyugly.Itwashardforme.Afterwritingthebestsellers,
gettingtheJolt,andbuildingathrivingconsultingpracticeina
downeconomy,IwantedtheJavatraintorollon,unstoppable,
alwaysbuildingonanever-strengtheningfoundation.Iwanted
Javatosendmyproductivitythroughtheroof,andforthe
impressivecommunityandbrainpowertosolveallthetough
problemsthatJavafacestoday,butnothinglastsforever.
Inthetalk,Ididn'tpickaneventualwinner.Ilaidoutthe
reasonsforJava'ssuccess,andthentalkedthroughitsmost
seriousproblems.Ishowedsomealternativelanguagesand
frameworks,asIsawthem.Throughoutthetalk,Ipointedout
thatconditionsareripeforanalternativetoemerge.AsI
addressedthehospitablegroup,Iansweredquestionsandread
faces.Afewlookedhostile,orhurt.Mostothersshowed
understanding,andalittlefear.Theyunderstoodmycentral
thrust.Formanyofthemostcommonproblemsthatwesolve
withJava,someotherframeworksinotherlanguagescan
alreadydoabetterjob.Insomecases,theproductivity
discrepancyiswideenoughtomeritaseriouslook.
Thetalk,andthequestions,wentonwaytoolong,butnobody
left.Theyweresurprisinglyreceptive.Afterthepresentation,
wewentouttoseesomeofOslo.Oneofthehostileattendees
corneredmeformostofthenight.Thehardquestionsjust
wouldn'tquitcoming:
Whycan'tweimproveJavatocovertheshortcomings?
Dotheotherframeworksandlanguagesthatyoupresented
haveenoughcommercialbacking?


Whataboutdistributedtransactions,orwebservices,or
XMLsupport?
Howcanyoufindprogrammers,ortraintheonesyoufind?
Thesequestionsarereal,andtheyshowthetremendous
barriersofentryagainstemerginglanguages.Myquestioner
wasagentleman,buthecouldnotcompletelyhidehisagitation
orhisdeep-seatedbeliefthatthehurdlesforthenext
successfullanguageareincrediblyhigh,andthatwe'llstillbe
codinginJavafortheforeseeablefuture.Hecouldwellberight.
ButI'vecometorecognizesomereallimitationsintheJava
language,andmanyoftheframeworksthatpowerit.For
certainproblems,Javajustisn'tproductiveenoughforme
anymore.I'veexperiencedsuccesswithsomealternatives.
Thoughalanguagecanlasthalfacenturytosupportlegacy
applications,Iknownolanguagecankeepitsleadershipandits
lusterforever.Java'sreignwillend.It'snotaquestionofif,but
when.


WhoShouldReadThisBook?
WhenC++fadedintorelativeobscurity,manyofmybest
friendsgotburned,badly.Theydidn'trecognizethatchange
wasintheair,orhowviolentlychangecouldcome.ThoughI
haveawholelottolose,I'mwritingthisbookbecauseIdon't
wanttoseeithappenagain.Ifyoudon'twanttobecaughtby
surprise,youneedtoreadthisbook.
IfyouthinkI'mright,youcanstarttobuildyourskills
accordingly.YoumightdownloadsomeoftheframeworksI
discuss,andlearnafewnewlanguages.Thisbookwillteach
youwhatanewlanguageneedstosucceed.IfI'vegottenlucky
andfoundoneofthelikelywinners,you'llbejustalittlebit
morepreparedwhenthingsdochange.
IfyouthinkIamwrong,youcanusethebesttechniquesfrom
thebestframeworkswritteninanylanguagetoimprovewhat
you'redoinginJavatoday.NewframeworkslikePHP,COmega
for.NET,andRubyonRailswillcomeoccasionally.Youneedto
knowaboutthem,andunderstandhowtoevaluatethem.
Eitherway,youwin.It'stimetostartpayingattentionagain.
It'stimetolooktothehorizon,beyondJava.


Conventions
Thefollowingtypographicalconventionsareusedinthisbook:

Italic
Usedforfilenames,directories,emphasis,andfirstuseofa
technicalterm.

Constantwidth
Usedincodeexamplesandforclassnames,method
names,andobjects.

Constantwidthitalic

Indicatesanitemthatshouldbereplacedwithanactual
valueinyourprogram.

Constantwidthbold
Usedforuserinputintextandinexamplesshowingboth
inputandoutput.Alsousedforemphasisincode,andin
ordertoindicateablockoftextincludedinanannotated
call-out.




UsingCodeExamples
Thisbookisheretohelpyougetyourjobdone.Ingeneral,you
mayusethecodeinthisbookinyourprogramsand
documentation.YoudonotneedtocontactO'Reillyfor
permissionunlessyou'rereproducingasignificantportionofthe
code.Forexample,writingaprogramthatusesseveralchunks
ofcodefromthisbookdoesnotrequirepermission.Sellingor
distributingaCD-ROMofexamplesfromO'Reillybooksdoes
requirepermission.Answeringaquestionbycitingthisbook
andquotingexamplecodedoesnotrequirepermission.
Incorporatingasignificantamountofexamplecodefromthis
bookintoyourproduct'sdocumentationdoesrequire
permission.
Weappreciate,butdonotrequire,attribution.Anattribution
usuallyincludesthetitle,author,publisher,andISBN.For
example:"BeyondJavabyBruceA.Tate.Copyright2005
O'ReillyMedia,Inc.,0-596-10094-9."
Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseor
thepermissiongivenabove,feelfreetocontactusat
permissions@oreilly.com.




CommentsandQuestions
Pleaseaddresscommentsandquestionsconcerningthisbookto
thepublisher:
O'ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
(800)998-9938(intheUnitedStatesorCanada)
(707)829-0515(international/local)
(707)829-0104(fax)
Thereisawebpageforthisbook,whichlistserrata,examples,
oranyadditionalinformation.Youcanaccessthispageat:
http://www.oreilly.com/catalog/beyondjava
Tocommentorasktechnicalquestionsaboutthisbook,send
emailto:
bookquestions@oreilly.com
Forinformationaboutbooks,conferences,ResourceCenters,
andtheO'ReillyNetwork,seetheO'Reillywebsiteat:
http://www.oreilly.com


Safari®Enabled

WhenyouseeaSafari®Enabledicononthecoverof
yourfavoritetechnologybook,itmeansthebookisavailable
onlinethroughtheO'ReillyNetworkSafariBookshelf.
Safarioffersasolutionthat'sbetterthane-books.It'savirtual
librarythatletsyoueasilysearchthousandsoftoptechnology
books,cutandpastecodesamples,downloadchapters,and
findquickanswerswhenyouneedthemostaccurate,current
information.Tryitforfreeathttp://safari.oreilly.com.




Acknowledgments
ThisbookchallengedmemorethananyotherbookI'vewritten.
IfeltthatIneededtobolstermyopinionswiththoseofother
respectedprogrammersandconsultants.Iaskedformany
opinions,andpublishedsomeoftheresponses.ThankstoMike
Clark,MattRaible,AndrewHunt,RamnivasLaddad,Brett
McLaughlin,andEitanSuezforansweringmyquestions.Thanks
especiallytoGlennVanderburg,TedNeward,ErikHatcher,
JustinGehtland,JamesDuncanDavidson,JimWeirich,Jamis
Buck,DavidHeinemeierHansson,DionAlmaer,JasonHunter,
RichardMonson-Haefel,StuartHalloway,andDennisSosnoski
foragreeingtoletmepostyourinterviewsinthebook.Thanks
againtoJustinGehtlandforuseofyourmetrics,andbeinga
partnerthroughtwowritingprojects.
SpecialthanksgotoDavidHeinemeierHanssonforaccessto
yourframeworkandcommunityfromtheinside.WhenIneeded
reviewers,youusedyourinfluencetofindthemforme.WhenI
hadhardquestions,youansweredthem.Youalsoprovidethe
irresistibleforcethatisRubyonRails.I'mgrateful.Ihopethis
bookmarksonlythebeginningofapartnership,andapossible
friendship.
DaveThomas,youhavegivenmethecourageandfaithto
explorethingsbeyondJava.You'vebeenarolemodelforme.
Yourconsistenthonorandclassteachme;yourskillwithyour
keyboardandyourvoiceinspireme;yourbusinesssense
instructsme.AviBryant,thanksforyourtirelessworkand
promotionontheSeasideframework.
SpecialthanksalsogoouttoMichaelLoukides.Supportingme
isyourjob,butIalsofeelaspecialkinship.We'vebeenthrough
alottogether,andIaimforthatrelationshiptocontinue.You've
beenverygoodformeandmywritingcareer.Ihopeyou've
benefitedinsomesmallway,too.


AfterlettingmyreadersdownbypublishingSpring,A
Developer'sNotebookbeforeitwasready,Ifeeltheneedto
offersomethanksforhelpingmethroughthenegativepress.
O'Reilly,youweregreattostandbehindme.IfeltthatIneeded
tohavethisbookreviewedexhaustively,topreventthesame
mistakefromhappeningtwice.Manyansweredthecall.Ted
Neward,VenkatSubramaniam,MichaelKoziarski,Jeremy
Kemper,MichaelLoukides(whogavemeadviceandideasfar
beyondtheusualeditorialsupport),andmanyotherstoo
numeroustolisthereprovidedgoodreviews.
Invariably,somereviewerstakeonabookasapersonal
mission.Usually,abookisluckytohaveonesuchreviewer.This
time,Ihadfour.SteveYegge,JasonHunter,DavidRupp,and
CurtHibbsallwentfarbeyondthecallofduty.Theyprovided
helpthatwasstylistic,philosophical,technical,andeven
structural.Thisbookisradicallydifferentfrommyinitialvision.
Thankstoallwhocontributed.
ToJayZimmermanandallofthoseI'vemetatNoFluffJustStuff,
thisbookisasmuchyoursasitismine.You'vehelpedme
shapeandsharpentheseideas,andyou'vegivenmeaplatform
topresentthem.
Mostofall,I'vegottorecognizethecontributionsofonespecial
ladyinmylife.SheproppedmeupwhenIwastoolowtowrite,
shetalkedthroughmanyoftheideas,shesatthroughmany
boringdinnersasItalkedthroughthisstuffwithanyonewho
wouldlisten.HersmilefillsmysoulwiththepassionthatIneed
forwriting,andgivesmeareasontobe.Weshareacommon
purposeinraisingourdaughters,KaylaandJulia,acommon
foundationoffaithinJesusChrist,anunendinghospitalityfor
wearycolleaguesontheroad,andasenseofadventureinlife.
Withoutyou,I'mnothing.Withyou,IfeellikeImatter,andmy
ideasmatter.You'reabiggerpartofthisbookthanyou'llever
know.Iloveyoualways.


Chapter1.OwlsandOstriches
SomekayakersthatIknowhaveadeathwish.Theybomb
downClassVrunswithrecklessabandon.Itseemslikea
matteroftimebeforetheyrunthatwaterfallthathastrapped
deadwoodunderneathit.Suchanobstaclewouldtraptheboat,
andtheforceoftheriverwouldpintheboaterunderwater.
They'relikeostriches,ignoringthedangerwiththeirheadinthe
sand.
There'sanotherkindofboater,though.WhenIfirststarted
kayaking,Iscoutedeverything.Iwouldstopatthemostcasual
ClassII+(beginner)rippletolookitoverandsetupsafety
ropesfor45minutesbeforemakingtherun.Often,I'drunout
oftimeonariver,andbeforcedtobombdownabottom
sectiontocompleteitbeforenightfall.Now,Irarelygetoutof
myboattoscoutmostminorrapids.Incertainplaces,it'sjust
notpractical.Instead,Iusechaseboatingtechniques,invented
inthenarrow,steepriversoftheSoutheast,toimprovemy
chances.Idon'tboatthiswaybecauseIlikedanger.Infact,
I'vehonedmyinstinctstounderstandwheredangerismost
likelytobe.Iboatthiswaybecauseitletsmefocusmy
scoutingtimewhereIneeditmost.Theseboatersaretheowls.
Itcomesdowntothis.I'lloftenignorerisksinvolvingminor
consequencesorlowfrequenciesbecausedealingwiththerisk
isnotwise.Managingtherisksproperlymaytaketoomuch
effort,money,ortime,openingmeuptoadditionalrisk,which
bringsmebacktoowlsandostriches.Normally,there'sahuge
differencebetweenthetwo,butoccasionally,owlswillget
overconfidentormakeminorerrorsinriskassessment,and
convincethemselvestorunsomethingdangerouswithout
scouting.That'shappenedtome.I'verunthesamecreek
hundredsoftimes,andsomethingchangeslikehigherriver
levelsorthecreekbedafteraflood.There'safinelinebetween


owlsandostriches.Sometimes,it'seventoughtotellthe
differencebetweenthetwo.Asakayaker,evenifI'vedecided
toignorecertainkindsofrisksoncertainriversandconditions,
I'vesometimesgottostepbackandreassesstherisk.That's
thesubjectofthisbook.




1.1.IgnoranceasaVirtue
Inmanyways,kayakingislikeprogramming.I'velearnedan
incredibletrick.Icanbesurprisinglyproductivebysimply
ignoringmostproblems.Withalittleluck,theproblemsoften
justgoaway.Suchanattitudecanworkforyouoragainstyou.
Manypostofficeclerksandminimum-wagefastfoodemployees
havelearnedthatthesametechniqueactuallyworksfortheir
problems,alsoknownascustomers.Theseareostriches.Ifyou
lookclosely,youcanfindsomeselective,wiseapplicationof
ignorancetheowl'strademark.Iactuallyfindthatmost
"problems"inprogrammingaremerelypotentialproblems.If
you'vereadanyofmybooks,youknowthatIpreachagainst
thedangersofprematureoptimization,andechothepopular
agileprincipleofYAGNI:"Youain'tgonnaneedit."Iusually
ignorebloatedframeworksthatpromisetosavemetime,
trustingmyinstinctstosimplersolutions.
Moretothepoint,I'vefoundthatJavadoeseverythingthatI
need,soIhaven'tlookedbeyondthesebordersforaverylong
time.Ignoranceisbliss.Iknowsomelanguagesaremore
dynamic,andpossiblymoreproductiveinspurts,butinthe
end,itseemslikeJavawillalwayswin.It'sgottensof
thousandsofframeworkstodoanythingfromrunningsystems
fornuclearreactorstoprogramminganembeddedcontrolleron
apowertoenailclipper.Manyofthebestframeworksareeven
free.IcanalwaysfindaJavadevelopertodowhatIneed.I
knowthatpeoplehavemadeitworktosolvemassiveproblems.
AndIknowthatmycustomerswillfeelsafeandsecure.In
short,thecommunityandbreadthofJavahavealwaystrumped
anythingthatthealternativeshavetooffer.SoIquitlooking.
AndI'mgladthatIdid,becauseitallowedmetofocuson
buildingaconsultingbusinessandsatisfyingmycustomers
insteadofdoingexhaustingresearchforeverynewproblem.
Whenadominantlanguageortechnologyisinitsprime,there's


ablissfulignorancestage,whenignoringalternativesworksin
yourfavor.Figure1-1showswhatImean.Whenanew
languagearriveswiththepoweranddominanceofaJavaor
C++,youcanaffordtoignorealternativesforawhile.Butif
youdon'taccuratelyidentifytheendofthecycle,youcanget
steamrolled.Suddenly,yourcompetitionhasthejumponyou,
withmuchbetterproductivityleadingtobetterquality,
improvedproductivity,andmorecustomers.Whenyouenter
thetransitiontime,you'dbetterstartpayingattention.
IadmitunashamedlythatIlikedhavingmyheadinthesand.It
waseasy,andproductive,andpoliticallysafe.Ibetthatmany
ofyouJavadevelopersactlikeme.Youmayhaveyourown
reasons.Livinginthisshelteriscertainlyeasierdoingnothing
trumpsextrawork.Youmightfeelsafernooneevergotfiredfor
choosingIBM.(OK,somaybeComponentBrokeron

Figure1-1.Foraperiodoftime,ignoranceis
productive,buttheendingofthatperiodcanbe
unpredictable

OS/2wasnotsuchagoodidea....)Youmayhaveanincredible
investmentinskillsthatyoubelievewillnotcommute,andif
you'veinvestedpoorlyinyourskillset,youmayberight.You
maybeboundlikeaSiamesetwintoJavabyalong-term


projectoragroupbasedonthelanguage.Likemyreasons,
manyofthesearesound.

1.1.1.ShakentotheCore
Afterlivinginblissfulignoranceforfiveyearsormore,Ihadan
experiencethatshookmetothecore.Iledanewstart-up
downapaththatrequiredwhatI'dconsiderthreeofthemost
productivelightweightframeworksoutthereforweb
developmentofpersistenceapplications:Hibernate,Spring,and
WebWork.Iknewtherewereslightlymoreproductive
environmentsforthiskindofthing,buttheyeitherwouldnot
scale(intermsofcomplexityorperformance),orwerenot
popularenoughtojustifytherisk.
MypartnerandIdecidedtoimplementasmallpartofthe
applicationinRubyonRails,ahighlyproductiveweb-based
programmingframework.Wedidthisnottosatisfyour
customer,buttosatisfyalittleintellectualcuriosity.Theresults
astoundedus:
Fortherewrite,weprogrammedfaster.Muchfaster.Ittook
Justin,myleadprogrammer,fournightstobuildwhatithad
takenfourmonthstobuildinJava.Weestimatedthatwe
werebetween5and10timesmoreproductive.
Wegeneratedone-fourththelinesofcode;one-fifthifyou
considerconfigurationfiles.
Theproductivitygainsheldupafterwemovedbeyondthe
rewrite.
TheRubyonRailsversionoftheapplicationperformed
faster.Thisisprobablynottrueofallpossibleusecases,


butforourapplication,theRoRactiverecordpersistence
strategytrumpedHibernate'sObjectRelationalMapping
(ORM),atleastwithminimaltuning.
Thecustomercaredmuchmoreaboutproductivitythan
beingonasafeJavafoundation.
Asyoucanwellimagine,thisshookmyworldviewdowntothe
foundation.I'mnowfranticallytryingtocatchup.Itseemsthat
conditionsontheriverchangedwithoutmynoticing.I'vegotto
startscoutingagain.


1.2.BoilingFrogs
Let'slookatitstillanotherway.You'vedoubtlesslyheardthatif
youputafroginhotwater,itwillleapout,butifyouslowly
bringtepidwatertoaboil,thefrogwilldiecontentedly.Andof
course,that'sthedebatethatIhopetotriggerinthisbook.Are
thewatersarounduswarming?Noticeattheendofmy
introduction,theowlandtheostrichareexactlythesamewhen
itcomestoconsequences.Theymaynotrecognizeit,but
motivationsdon'tmatteronelittlebit.Ifthewaterstartsto
boil,iftheconditionsontheriverchange,they'llbothdie.
Thispastyear,Idecidedtowakeuptomysurroundingstotest
thewateraroundme.IlearnedbothRubyandaspect-oriented
programming(AOP).Aftercheckingthetemperature,Ithink
thewaterisactuallyheatingup.It'snotboilingyet,andIdon't
knowifitwilleverboil.ButIdoknowthatI'mgoingtokeepa
closeeyeonthetemperatureforawhile,andIhopeto
convinceyoutodothesame.Letmetellyouwhy.

1.2.1.DangerSigns
Alargenumberoftheapplicationsthatwewriteputawebbasedfrontendoveradatabase,sometimeswithadditional
businessrulesandsometimeswithout.Yet,aftermorethanfive
yearsofsolvingthisproblemoverandover,westillcan'tsolve
itveryquicklyintheJavaspace.Further,mostJavaframework
developersaremakingincrementalchangesthatwon'ttruly
revolutionizewebdevelopment.Buildinganewteamtosolve
thisproblemintherightwayisademandingjob.Buildinga
teamfrom,say,COBOLprogrammers,isnearlyimpossible.The
languageistooalien,theframeworkstooextensive,andthe
landscapetoounstable.Evenwithseasoneddevelopers,ittakes
asurprisingamountofcodetogetevensimpleapplicationsoff


theground.


JasonHunter:TheNextBigThing
AuthorofJavaServletProgramming

JasonHunterworksasaleadapplicationsengineeratMarkLogic.He'sthe
authorofJavaServletProgramming(O'Reilly).AsApache'srepresentativetothe
JavaCommunityProcessExecutiveCommittee,heestablishedalandmark
agreementallowingopensourceJava.HeispublisherofServlets.comand
XQuery.com,isanoriginalcontributortoApacheTomcat,isamemberofthe
expertgroupsresponsibleforServlet,JSP,JAXP,andXQJAPIdevelopment,and
hasparticipatedintheW3CXQueryWorkingGroup.Healsoco-createdtheopen
sourceJDOMlibrarytoenableoptimizedJavaandXMLintegration.

JH:Java'salreadyendeditsleadershiprun.Ithappened
maybetwoyearsagowhenthebestbrainsintheindustry
stoppedfocusingonJavaasatechnologyandstarted
splittingoffintootherareasofinterest.It'sonlygottenworse
IsJavain asoflate.ThedepartureofJoshBlochandNealGaftnerto
dangerof Googleisahigh-profilesignofthechangingtide.Butthey're
losingits notalone.Ifyouwanttopushtheenvelopethesedays,you
leadership don'tdoitbyinnovatingonJava.YoumaydoitwithJava,
position? butnotonJava.
Itdoesn'tmeanJava'sdead.ItjustmeansJavaisn'tcutting
edgeanymore.It'splentyunderstood,plentystable,and
entirelyreadyforoutsourcing.
JH:What'snext?Idon'tthinkthere'sonething.There's
definitelynotonelanguage.Java'sstilltheubiquitous
language.Theinnovationnowishappeningontop.Exciting
areas:webremoting(a.k.a.Ajax),search(a.k.a.Googleand
XQuery),andfolksonomies(a.k.a.flickrtags).
Ihaveaverypracticalwayofevaluatingwhatisthehot
technology:[determining]whatearnsyouthemostmoney
beingatrainerofthattechnology.Javadefinitelywasthehot
technologyforyears.IearnedtwicewhattheC++trainers
werereceiving.Itwasn'tthatJavawasharder,justthatthere
wasmoredemandthansupply.
Ifyoutrainonsomethingcommoditized(likeC++wasand


Javaisnow),yougetmass-marketrates.Ifyoutrainon
somethingtoobleedingedge,youdon'tgetenough
customers.

What's
next?

Idon'tseeanymovementrightnowthat'sgotthesame
hugeswellpotentialasJavahad.Whatarethe"alphageeks"
doing,asTimO'Reillycallsthem?Well,JamesDavidsondug
deeplyintotheMac.Butthere'snotahugeamountofroom
forexpertsinthatmarket.Therearen'tenoughbusiness
dollarstobeearned.I'vegoneintoXQuery,whichI'vefound
afunandusefulwaytobringsearchideas"in-house"andput
youincontrolofwhatyoufindandwhatyoudowithit.Mike
Clarkbecameanexpertonautomation.Myadvicetopeople
withoutatargetyetistolearnSubversionandhelp
companiestransitionfromCVStoSVN.
Butwe'reallgoinginseparateways.We'veagreedonthe
Javabase,butaredivergingonwhatwedowiththatnowubiquitousstandard.
YourquestionsareveryfocusedonJavaand"alternativesto
Java."TheWebwasn'tanalternativetoWindows.Itwas
different.Thetechphasewe'reinnowisn'taboutan
alternativetoJava.It'sdifferent.We'regoingtotakeJavafor
grantedjustlikewetakeCPUsforgranted:it'snecessary.It
wasoncetheplacewhereallthemoneywas;nowit'smore
ofacommodity.

1.2.2.
1.2.2.1.Complexity
Javaseemstobemovingawayfromitsbase.Youmightsolve
thehardestproblemsmoreeasily,butit'smuchharderto
createsimplewebappsthaniteverhasbeenbefore.James
DuncanDavidsoncallsthisproblemapproachability.WhenJava
wasyoung,youdidn'thavetoknowmuchtobuildabasic
applet.Now,tobuildasimplewebappusingthemostpopular
frameworks,youneedtoknowmuchmore.


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×