Tải bản đầy đủ - 0 (trang)
Chapter 11. Where Do We Go from Here?

Chapter 11. Where Do We Go from Here?

Tải bản đầy đủ - 0trang

11.1Technology

Bynow,youprobablyunderstandthatIbelievetechnologyis

onlyasmallpartofanygivenproblem.Javaisnotthebest

programminglanguagethat'severexisted,althoughit'seasily

amongthemostsuccessful.Thetoolsarenotnearlyas

importantasthehandsthatwieldthem.Thatsaid,technology

doesleadanydiscussionaboutthefutureofadominant

platform.



11.1.1LessIsMore

ByfarthebiggestchallengeJavadevelopersfaceistheissueof

complexity.I'mstartingtoseemoreadvancedcustomersscale

downbystrategicallysteppingbackfromtraditionalJ2EE

applicationmodelssuchasEJBwithCMPtosimplermodels

suchassimplePOJOdeployedonTomcat.It'sdifficultto

estimatehowwelllightweightcontainersaredoing,butthe

earlybuzzandadoptionratesarepromising.Thetrendtoward

simplicityislikelytopickupmomentuminotherplaces.

Hibernateiswildlysuccessfulnotbecauseit'smorepowerful

thanTopLinkorEJBCMP,butbecauseit'ssimpler.JUnithas

beenmoresuccessfulthananyothertestingframework,byfar.

Thesuccessofthesetypesofframeworksmusttroublelarger

vendors.Thetopwebapplicationservervendors,BEA,Sun,

Oracle,andIBM,musttakenoticeofthesimplicitytrend.

They'vegotnochoice,becausetheircustomersarestruggling

withJ2EE.Youcanalreadyseethosevendorsstarttoembrace

simpler,lighterframeworks:

MostvendorsarenotsellingEJBsolutionsasstronglyas

theyoncewere.VendorsareespeciallybackingoffofEJB



CMPforpersistencesolutions.

Manyvendorsarequietlydevelopingalternativepersistence

strategies.OraclehasacquiredTopLink,SunandJBosshave

includedJDOsolutionswiththeirapplicationservers,and

IBMisnowco-marketinganotherpersistencesolution.

Vendorsareworkingtobuildbetter,simplifiedtoolsfortheir

communities.IBMhasworkedwiththeEclipseprojectto

simplifyandreplacetheirmassiveVisualAgeproductsuite,

andBEAisincreasingtheirinvestmentsinWorkBench,

whichsimplifiesdevelopmentofwebservicesapplications.

Still,there'salongwaytogo.Thecurrentwebservices

specificationisspinningoutofcontrolandclosinginon

permanentbloat-warestatus.XMLisgettingsocomplicatedand

awkwardthatsomeresearchersarealreadyseekingan

alternative.



11.1.2OpenSource

I'mnotconvincedthatthefuturedirectionoftheJavaplatform

couldorevenshouldcomefromthemajorJ2EEvendors.You

canseetheresultsofcommittee-drivenbig-enterprisedesign:



EJB

Vendorsandcustomersalikespendtoomuchtimebuilding

onthisdead-endtechnology.



Generics



TheimplementationofgenericsinJava1.5isasolution

withoutaproblem.Thecurrentimplementationforcesan

interfaceandincreasestheburdenoftheprogrammer,for

verylittlebenefit.



Webservices

Earlyversionsofwebserviceswerelightandsimple.Later

versionshavepatchedafewholesandalsodramatically

increasedthecomplexity.



Logging

Log4jisafantasticopensourcesolution,butSundecidedto

goitalone,creatingacompetingandmanysayinferior

implementation.

AsIsaidinChapter1,thepressureforlargercompaniesto

buildbloatedsoftwareissometimestoodifficulttoresist.Some

ofthejuggernautsarestartingtounderstandthis.IBM,for

example,isshowinginterestinopensourcesoftware.They

knowthatembracingopensourcesoftwaremakesgood

businesssenseandcanbringinnovationstolightthatmaynot

havesurfacedinotherways.

TheopensourcecommunityfillsanimportantnicheintheJava

community.Itallowssoftwaretoevolveandimprovebasedon

usagepatternsofitscustomers.Manyoftherevolutionary

ideasintheJavacommunityhavecomefromopensource

projects:

MVCtemplatetechnologiessuchasStrutschangedtheway

weintegrateuserinterfaces.



JUnitchangedthewayweintegrateandtestsoftware.

Antchangedthewaywebuildsoftware

EclipseandTomcatchangedthewaybigvendorsapproach

opensourcesoftware.

Hibernatechangedthewaywethinkaboutreflectionand

transparentpersistence.

Thenextgenerationofopensourcesoftwareisalreadymaking

waves.You'veseenSpring,oneofthelightweightcontainers

thatdramaticallyimprovesintegrationandassembly.Luceneis

acleantextsearchengineopeningupapplicationstosearches

thatgobeyondthedatabase.Velocity,WebWorks,andTeaare

user-interfacetechnologiesthatarechallengingthestateofthe

art.Theseprojectshavethepotentialtochangethewaywe

codeindramaticways.Beyondindividualprojects,opensource

softwarehasanotheraffectontheindustry.True,opensource

softwareisnotrightforeverycustomer,butLinuxandthe

Apachewebserverbothhavethemarketshareandindustry

backingtobelong-termplayers.Figure11-1showsthetypical

componentsandservicesofanenterpriseapplication.Corporate

shopsareconservativewiththeiradoptionofopensource

solutions.Still,penetrationofopensourcesoftware,shownin

darkercolorsinFigure11-1,isincreasing.Already,conservative

customers,includingbanksandinsurancecompanies,are

deployingopensourceoperatingsystemsandwebserversin

increasingnumbers.Inthepastfiveyears,TomcatandJBoss

havealsomadeinroads.It'sonlynaturalthatthelinebetween

what'sacceptableopensourceandwhat'sproprietaryisalways

movingfurtherup.Ibelievethatitwillcontinuetodoso.In

particular,databasesandpersistenceareservicesripeforopen

sourcedeployment.



Figure11-1.Opensourcepenetrationis

increasing



Idon'tthinkitthistrendwillstopwiththewebserver.While

workingatIBM,Ineverreadonelineofopensourcecode,but

thatsituationischangingquickly.ForIBM,Eclipseisonlythe

beginning.TheyarebeginningtoexertpressureonSuntoopen

upmajorpiecesoftheJavaplatform.Theymaynotsucceed,

butit'shardtoargueagainsttheincreasingrolesthatopen

sourcesoftwarecanplay.OracleandBEAtesttheirsoftwarefor

compatibilitywithkeyopensourceprojectslikeTomcat,and

alsogenerateStruts-compliantcode.



11.1.3Aspect-OrientedProgramming(AOP)

Manyaprogrammerhastriedtodesignprogramming

paradigmsthatmakeenterprisedevelopmenteasier.Objectorientedprogramminghelps:youcanmakemodelswith

businessrulesthatlookandactmuchmoreliketherealworld.

ButOOPcanonlygetyoupartofthewaythere.

Certainservicescalledcrosscuttingconcernsaredifficulttoadd

toanenterpriseapplicationbecauseyouneedtoapplythem



broadly,basedonachangingpolicy.Forexample,many

differentobjectsmightneedtobepersistent.Youmaywantto

addallmethodstoanauditlog.Youmightalsowantacertain

kindofmethodtoparticipateinatransaction.Youdon'twantto

addthiskindofservicecodetoalloftheclassesinan

application.

You'veseenthatobject-orientedprogrammerstriedtosolve

thisproblemwithinheritance,interfaces,orprogramming

modelslikecontainers.I'vemadeacasethatthebestservice

implementationtechniquespreservetransparencywithrespect

totheservice.

AOPsoftwareisanattempttomakeiteasiertoproduceand

consumefar-reachingservices(crosscuttingconcerns)while

maintainingtransparentmodels.Here'showitworks:

Breakoutcoretasks,calledconcerns,fromyour

requirements.Thecoreconcernisthebusinesspurposeof

yourapplication,suchasmakingreservationsina

reservationsystem.Otherconcerns(crosscuttingconcerns)

shouldbeseparatedfromtherequirements.

Codeindividualaspectsindividually.Thisiswhereyou'll

noticethebiggestproductivityboost.Youarefreetothink

ofeachproblemindependently,allowingforbetterfocus

andbetterreuse.

Configurethepolicyforeachconcern.Here,youspecify

howtoidentifythemethodsofyourcoreconcernandhow

toapplyyourconcern.

Yourframeworkweavestheconcernstogetherbasedonthe

configurationandimplementationofeachconcernusinga

toolcalledaweaver.



That'sthepremiseofAOP.Likemostpowerfulideas,it's

remarkablysimple.Thedetails,though,cangettediousto

implementAlthoughsomeresearchersandleading-edge

developersarealreadyusingAOP,it'smybeliefthatitwilltake

afull-blown,successfulaspect-orientedlanguagetomakethe

languagethriveinthemainstream.Wesawthesame

phenomenonwithobjecttechnologyintheearly1990s.Itjust

takestimefortheindustrytomovewhenitcomestomajor

paradigms.

Idothinkthatyou'llstarttoseesomeaspect-orientedideas

quicklymoveintothemainstreamwellbeforeAOPfully

matures.InChapter8,yousawseveralAOPideasinactionin

Spring'stransactionmanagement:

Springprovidesmethodinterceptorstoattachfunctionality

toanexistingmethodwithoutchangingthemethod.

Springprovidesapointcutmodeltodescribethemethods

thatrequireagivenconcern,suchasatransaction.

Otherframeworks,suchasJBoss,usecoreAOPideaslike

methodinterceptors,andthat'slikelytocontinue.Whenenough

developersuseAOPideas,itwillbemucheasierforanaspectorientedlanguagetoestablishitselfwhenthemarketconditions

areright.Althoughyoudon'tyetseeAOPideasinthe

mainstream,youdoseeseveralframeworkswithanAOPflavor.

Themostcommononeispersistence.



11.1.4Persistence

IfyoulookcloselyatJDO,youcanseeseveralAOPideas.

Persistenceisacrosscuttingconcern.JDOaddressesitby

implementingtheconcernindependentlyofthecoreconcern

(yourapplication).JDOthenusesbytecodeenhancementto



effectivelyinterceptaJavathreadofexecutionandinjectcalls

totheJDOlibrariesor,moregenerally,thepersistenceaspect.

It'saneffectivesolution.I'vebeenimpressedwiththeKodo

JDOproductproducedbySolarMetric.Theperformance,

flexibility,andpoweroftheframeworkisimpressive,andbig

customersarestartingtotakenotice.Itwarmsmyheart,

becausetransparentpersistenceisimportant.

Nearlyallenterpriseapplicationshavesomepersistence

element.Insomeways,theEJBCMPimplementationhasdone

usadisservicebecauseit'smademanygun-shy.Thestatesof

technologyinpersistenceframeworks,RDBMStechnology,and

hardwarehavecomefarenoughtomaketransparent

persistencepossible.Whilenotallapplicationsneedpersistence

frameworks,manydo.It'scriticallyimportantfortheJava

communitytoestablishaneffectivestandardfortransparent

persistence.ItlookslikeJDO2.0mightbejustwhatweneed.



11.1.5Containers

MostapplicationsdonotneedEJB.It'sjusteasiertobuilditall

fromscratch,addingintheoccasionalusefulJ2EEserviceas

needed.I'llgoevenfurther:fortheoccasionalapplicationwith

trueheavyweightenterpriserequirements,there'sabetterway.

AfterreadingChapter1andChapter8,youknowthatIbelieve

we'relateintheeraoftheheavyweightJ2EEcontainer.They'll

eitherwaneorJavawilldie.Theywon'tbekilledbya

technologysomuchasbyanidea:thattheideaofdependency

injectionhaspower.Rightnow,I'veonlycodedminor

applicationsinSpring,butafterusingSpringintheplaceofmy

J2EEcontainer,Iwonderedwhatwasmissing.

Soonerorlater,customerswillnoticethatthey'respendingalot

ofmoneywithoutalotofbenefit.Whenthathappens,vendors

willrespond.Whethertheywritetheirownorembraceopen



sourcecontainersdoesn'tmakeanydifference.Theideaofthe

lightweightcontaineriswhat'simportant.Thecatisoutofthe

bag,anditwillbetoughtogetitbackin.



11.2Process

Afteraboutadecadeofstringent,heavyweightprocesses

culminatingintherationalunifiedprocess(RUP),thependulum

isfinallyswingingbackinamoresanedirection.Whilemany

largerITshopsareslowtoadoptthem,someoftheideasfirst

collectedintheExtremeProgramming(XP)methodarefinally

makingitintothemainstream.Overthenextcoupleofyears,

thoseideaswillgainmomentum.I'mseeingcustomerswho

werehell-bentagainstagiledevelopmentstronglyconsiderit.It

takesalongoftimetoturnabattleship,butit'shappening.

Continuousintegration,automatedunittesting,andsimplicity

areallgettingmoreandmoreattention.Soon,you'llseefullblowntest-drivendevelopmentcreepintoconservative

programmingorganizations.Theideasarepowerfulandsound.

Thenextimportantstepisthereductionoftools.Rightnow,

manydevelopersspendtoomuchtimesupportingformal

documentationratherthanconcentratingonreadablecode.

Formalized,full-blownUML-stylemodelingwillnothelpa

projectasmuchassimplertemporarydiagramsona

whiteboard.Theroleofadiagramistoimproveunderstanding;

ifyouareonlyproducingitbecauseyouhaveto,andnot

becauseitaddsvaluetothedesign,thendon'tbother.Ialso

thinkmodel-drivenarchitecture(MDA)ismovinginthewrong

direction.Generatedcodeonsuchascaleisrarelylegible,and

visuallanguageshaveconsequencesonperformance,reuse,

andreadabilitythatwe'reonlynowcomingtounderstand.

You'rebetteroffwritingsimple,concisecodefromscratchthat's

easytounderstandandmaintain.

Asthatbattleshipcomesaround,somevendorswillresistthe

simplerprocess.IBM'srecentpurchaseofRationalgivesmore

financialbackingtothevendorsupportingoneoftheheavier

developmentprocesses,andthey'restartingtomuddythe

watersbylabelingsomeoftheirowntoolswiththeAgilelabel.



Hopefully,independentconsultantsandacademicswill

championthelightweightdevelopmentprocessesthatarefar

moreappropriateformostoftheapplicationsbuilttoday.

Evenifyou'renotreadytoadoptawholenewdevelopment

process,takeadvantageofsomeoftheprinciples.Automate

yourtests,valuesimplicity,andintegratecontinuously.



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

Chapter 11. Where Do We Go from Here?

Tải bản đầy đủ ngay(0 tr)

×