




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
DesignPatterns,ArchitecturalPatternsPascalMolliUniversityHenri-PoincaréPascal.Molli@loria.fr1Bibliography…?
ASystemofPattern
?BushmannetAll?
DesignPatterns
?GammaetAll?
ConcurrentProgramminginJava
?D.Lea.?
DistributedObjects
?OrfalietAll?
ApplyingUMLandPatterns
?Larman2Patterns…?
Patternshelpyoubuildonthecollectiveexperienceofskilledsoftwareengineers.
??
Theycaptureexisting,well-provenexperienceinsoftwaredevelopmentandhelptopromotegooddesignpractice
??
Everypatterndealswithaspecific,recurringprobleminthedesignorimplementationofasoftwaresystem
??
Patternscanbeusedtoconstructsoftwarearchitectureswithspecificproperties…
?3BecomingaChessMasterFirstlearnrulesandphysicalrequirementse.g.,namesofpieces,legalmovements,chessboardgeometryandorientation,etc.
Thenlearnprinciplese.g.,relativevalueofcertainpieces,strategicvalueofcentersquares,powerofathreat,etc.
However,tobecomeamasterofchess,onemuststudythegamesofothermastersThesegamescontainpatternsthatmustbeunderstood,memorized,andappliedrepeatedlyTherearehundredsofthesepatterns4BecomingaSoftwareDesignerMasterFirstlearntherulese.g.,thealgorithms,datastructuresandlanguagesofsoftware
Thenlearntheprinciplese.g.,structuredprogramming,modularprogramming,objectorientedprogramming,genericprogramming,etc.
However,totrulymastersoftwaredesign,onemuststudythedesignsofothermastersThesedesignscontainpatternsmustbeunderstood,memorized,andappliedrepeatedlyTherearehundredsofthesepatterns5SoftwareArchitectureAsoftwarearchitectureisadescriptionofthesubsystemsandcomponentsofasoftwaresystemandtherelationshipsbetweenthem.
Subsystemsandcomponentsaretypicallyspecifiedindifferentviewstoshowtherelevantfunctionalandnon-functionalpropertiesofasoftwaresystem.
Thesoftwaresystemisanartifact.Itistheresultofthesoftwaredesignactivity.6ComponentAcomponentisanencapsulatedpartofasoftwaresystem.Acomponenthasaninterface.Componentsserveasthebuildingblocksforthestructureofasystem.
Ataprogramming-languagelevel,componentsmayberepresentedasmodules,classes,objectsorasetrelatedfunctions.7SubsystemsAsubsystemisasetofcollaboratingcomponentsperformingagiventask.Asubsystemisconsideredaseparateentitywithinasoftwarearchitecture.
Itperformsitsdesignatedtaskbyinteractingwithothersubsystemsandcomponents…8ArchitecturalPatterns AnarchitecturalPatternexpressafundamentalstructuralorganizationschemaforsoftwaresystems.Itprovidesasetofpredefinedsubsystems,theirresponsibilities,andincludesrulesandguidelinesfororganizingtherelationshipsbetweenthem.9Designpatterns Adesignpatternprovidesaschemeforrefiningthesubsystemsorcomponentsofasoftwaresystem,ortherelationshipsbetweenthem.Itdescribesacommonly-recurringstructureofcommunicatingcomponentsthatsolvesageneraldesignproblemwithinaparticularcontext.10Idioms AnIdiomisalow-levelpatternspecifictoaprogramminglanguage.Anidiomdescribeshowtoimplementparticularaspectsofcomponentsortherelationshipsbetweenthemusingthefeaturesofthegivenlanguage.11Framework Aframeworkisapartiallycompletesoftware(sub-)systemthatisintendedtobeinstantiated.Itdefinesthearchitectureforafamilyof(sub-)systemsandprovidesthebasicbuildingblockstocreatethem.Italsodefinestheplaceswhereadaptationsforspecificfunctionalityshouldbemade.12FirstExampleADiceGameAPlayerrolls10x2dicesIfresult=7,score=score+10pointsAttheend,scoreoftheplayerisregistredinthehighscoretable.13menuviewHighscoreStartturn=0RollDiceturn++UpdatehighscoreTurn<10[highscore][start][exit][true][false]ActivityDiagram14AnalysisDiagram…15DesignStageManageUserInterfaceManagePersistenceofhighscoreinafileorinrelationaldatabaseRealizeanlayeredarchitecture:ApplytheLayerArchitecturalPattern16Layerhelpstostructureapplicationthatcanbedecomposedintogroupsofsubtasksinwhicheachgroupofsubtasksisataparticularlevelofabstraction.17Layer:examples18Layer:Structure19Layer:Structure20Layerandcomponents…21Layers:VariantsRelaxedLayeredSystem:Alayer?
j
?canuseserviceofj-1,j-2…AlayercanbepartiallyopaqueSomeservicetolayerj+1,otherstoallupperservices…Layeringthroughinheritance:LowerlayersareimplementedasbaseclassesHigherlevelcanoverridelowerlevel…22Layers:KnownUsesVirtualmachines:JVMandbinarycodeformatAPI:LayerthatencapsulateslowerlayersInformationSystemPresentation,Applicationlogic,DomainLayer,DatabaseWindowsNT(relaxedfor:kernelandIOandhardware)Systemservices,Resourcemanagement(Objectmanager,securitymonitor,processmanager,I/Omanager,VMmanager,LPC),Kernel(exceptionhandling,interrupt,multiprosynchro,threads),HAL(HardwareAbstractionLevel)Hardware23Layers:benefitsReuseoflayersSupportforstandardization(POSIX)DependenciesarekeptlocalExchangeabilities:ReplacementofoldimplementationwithAdapterPatternDynamicexchangewithBridgePattern24Layers:LiabilitiesCascadesofchangingbehaviorLowerefficiencyUnnecessarywork:functionsofalayercalledmanytimesforoneserviceDifficultyofestablishingcorrectgranularityoflayers:Tofewlayer->lessbenefits,tomuchlayer->complexityandoverhead…25ApplyingLayerArchitecturePlayViewHighScoreFichierouBDDUICorePersistence26Package
decompositionUI<<layer>>Core<<layer>>Persist<<layer>>Util<<subsystem>>27Layer?
core
?Containbusinesslogicclasses…AdaptanalysisclassesforimplementationUseofsingletonIdiom…28Singleton(Idiom)Ensureaclassonlyhasoneinstance,andprovideaglobalpointofaccesstoit.29SingletonStructure30Core?
Layer
?:1erdiagrammeDesignAnalyse31Package
decompositionUI<<layer>>Core<<layer>>Persist<<layer>>Util<<subsystem>>32ObserverOne-to-manydependencybetweenobjects:changeofoneobjectwillautomaticallynotifyobservers33Observer:ApplicabilityAchangetooneobjectrequireschanginganunknownsetofothersObjectshouldbeabletonotifyothersthatmaynotbeknownatthebeginning34Observer:Structure35Observer:ConsequencesAbstractcouplingbetweensubjectandobserverSupportforbroadcastcommunicationHardtomaintain36ApplyingObserverPattern37ObserverView38Viewsaregraphicalobjects39SettingupObserver40Observer:ChangePropagation:Die:Randomizer:DieView1:getValue()2:setValue(int)3:notifyObservers()4:update(Observable,Object)5:getState()3:JLabel6:setText(3)41Architectureencouche...UICoreDecouplingclassesandinterfaces42Package
decompositionUI<<layer>>Core<<layer>>Persist<<layer>>Util<<subsystem>>43PatternFactoryMethodIntentDefineaninterfaceforcreatinganobject,butletsub-classesdecidewhichclasstoinstantiateletaclassdeferinstantiationtosubclassesAlsoknownasVirtualConstructor44FactoryMethod Applicability:Usewhenaclasscannotanticipatetheclassofobjectsitmustcreateaclasswantsitssubclassestospecifytheobjectsitcreatesclassesdelegateresponsibilitytooneofseveralhelpersubclasses,andyouwanttolocalizetheknowledgeofwhichhelpersubclasstodelegate.45Structure46FactorymethodConsequencesProvidehooksforsubclassesconnectsparallelclasshierarchiesKnownusesMacApp,ET++ClassViewinsmalltalk80MVC(controllercreation)OrbixORBforgeneratingPROXYobject47Layer?
Persist
?ClassestechniquesdepersistancesAssurerl
’indépendanceCore/Persistpouvoirchangerde?
persistentengine
?Parexemple:Persistancepar?
Sérialisation
?Persistanceviaunebasededonnéesrelationnelle(JDBC).48ApplyingFactoryProduitabstraitFabriqueabstraiteProduitconcretFabriqueconcrête49ApplyingFactory50Summary1Architecturalpattern:Layer2DesignPatterns:Observer,Factory1Idiom:SingletonPb:Combiningpatterntocombinetheirforces…5152
Bankexample…Abasicbanksystem:1bank,nAccount.
Eachaccountbelongto1client.Eachaccountiscreditedbyanamountamoney.BankfunctionsWithdrawalonaaccount,Creditanaccount,Transfermoneyfromoneaccounttoanother…53Naivesolution54NaiveSolution55ApplyingCommandPattern…Encapsulatearequestasanobject,therebylettingyouparameterizeclientswithdifferentrequests,queueorlogrequests,andsupportundoableoperations.56CommandExample57CommandExample58CommandStructure59CommandStructure60CommandConsequencesCommanddecouplestheobjectthatinvokestheoperationfromtheonethatknowshowtoperformit.Commandsarefirst-classobjects.Theycanbemanipulatedandextendedlikeanyotherobject.
It'seasytoaddnewCommands,becauseyoudon'thavetochangeexistingclasses.61ApplyingCommandPattern62ApplyingCommandPattern63CompositePatternComposeobjectsintotreestructurestorepresentpart-wholehierarchies.Compositeletsclientstreatindividualobjectsandcompositionsofobjectsuniformly.64CompositeExample65CompositeExample66CompositeStructure67ApplyingCompositeonCommand68ApplyingComposite6970ApplyingSingleton71AndSoon…Storingstate:MementoPatternObservingAccount:ObserverPatternVisitingallobjectgraph:VisitorPatternRemoteaccess:Proxypattern…72ProxyPatternProvideasurrogateorplaceholderforanotherobjecttocontrolaccesstoit.73ProxyExample74ProxyStructure75Proxybenefitsremoteproxycanhidethefactthatanobjectresidesinadifferentaddressspace.Avirtualproxycanperformoptimizationssuchascreatinganobjectondemand.
Bothprotectionproxiesandsmartreferencesallowadditionalhousekeepingtaskswhenanobjectisaccessed.76From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al77AdapterPatternConverttheinterfaceofaclassintoanotherinterfaceclientsexpect.Adapterletsclassesworktogetherthatcouldn'totherwisebecauseofincompatibleinterfaces.78AdapterExample79AdapterStructure80VisitorPatternRepresentanoperationtobeperformedontheelementsofanobjectstructure.Visitorletsyoudefineanewoperationwithoutchangingtheclassesoftheelementsonwhichitoperates.81Visitorexample82Visitorexample83Visitorapplicabilitymanydistinctandunrelatedoperationsneedtobeperformedonobjectsinanobjectstructure,andyouwanttoavoid"polluting"theirclasseswiththeseoperations84VisitorStructure85VisitorStructure86VisitorConsequencesVisitormakesaddingnewoperationseasyAvisitorgathersrelatedoperationsandseparatesunrelatedonesAddingnewConcreteElementclassesishardVisitingacrossclasshierarchiesAccumulatingstate.Breakingencapsulation87ChainofresponsabilityAvoidcouplingthesenderofarequesttoitsreceiverbygivingmorethanoneobjectachancetohandletherequest.Chainthereceivingobjectsandpasstherequestalongthechainuntilanobjecthandlesit.88
89ChainofResponsability90Chainofresponsability91ParticipantsHandler(HelpHandler) definesaninterfaceforhandlingrequests.(optional)implementsthesuccessorlink.ConcreteHandler(PrintButton,PrintDialog)handlesrequestsitisresponsiblefor.canaccessitssuccessor.iftheConcreteHandlercanhandletherequest,itdoesso;otherwiseitforwardstherequesttoitssuccessor.Client
initiatestherequesttoaConcreteHandlerobjectonthechain.92Example…Awt1.0From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al93StrategyDefineafamilyofalgorithms,encapsulateeachone,andmaketheminterchangeable.Strategyletsthealgorithmvaryindependentlyfromclientsthatuseit.94Strategy…95Strategy96ParticipantsStrategy(Compositor)declaresaninterfacecommontoallsupportedalgorithms.ContextusesthisinterfacetocallthealgorithmdefinedbyaConcreteStrategy.ConcreteStrategy(SimpleCompositor,TeXCompositor,ArrayCompositor)implementsthealgorithmusingtheStrategyinterface.Context(Composition)isconfiguredwithaConcreteStrategyobject.maintainsareferencetoaStrategyobject.maydefineaninterfacethatletsStrategyaccessitsdata.97Strategy…From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al98StateAllowanobjecttoalteritsbehaviorwhenitsinternalstatechanges.Theobjectwillappeartochangeitsclass.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al99ExempleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al100StructureFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al101ConsequencesItlocalizesstate-specificbehaviorandpartitionsbehaviorfordifferentstatesItmakesstatetransitionsexplicitStateobjectscanbesharedFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al102DecoratorAttachadditionalresponsibilitiestoanobjectdynamically.Decoratorsprovideaflexiblealternativetosubclassingforextendingfunctionality.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al103ExampleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al104ExampleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al105ExampleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al106StructureFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al107Applicabilitytoaddresponsibilitiestoindividualobjectsdynamicallyandtransparently,thatis,withoutaffectingotherobjects.forresponsibilitiesthatcanbewithdrawnwhenextensionbysubclassingisimpracticalFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al108ConsequencesMoreflexibilitythanstaticinheritanceAvoidsfeature-ladenclasseshighupinthehierarchyAdecoratoranditscomponentaren'tidenticalLotsoflittleobjectsFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al109From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al110BridgeDecoupleanabstractionfromitsimplementationsothatthetwocanvaryindependently.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al111BridgeFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al112BridgeFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al113BridgeStructure…From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al114BridgeDecouplinginterfaceandimplementationImprovedextensibilityHidingimplementationdetailsfromclientsFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al115ExampleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al116From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al117BuilderSeparatetheconstructionofacomplexobjectfromitsrepresentationsothatthesameconstructionprocesscancreatedifferentrepresentations.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al118BuilderFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al119BuilderStructure…From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al120BuilderFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al121BuilderConsequencesItletsyouvaryaproduct'sinternalrepresentationItisolatescodeforconstructionandrepresentationItgivesyoufinercontrolovertheconstructionprocessFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al122FlyWeightUsesharingtosupportlargenumbersoffine-grainedobjectsefficiently.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al123FlyWeightFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al124Flyweight:StructureFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al125FlyweightexampleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al126Flyweight:InstancesFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al127Flyweight:ApplicabilitéEtatintrinsèque/extrinsèque…Lesétatsextrinsèquespeuventêtrecalculés…From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al128Flyweight(ilariencompris…)From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al129IteratorProvideawaytoaccesstheelementsofanaggregateobjectsequentiallywithoutexposingitsunderlyingrepresentationFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al130IteratorFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al131Iteratorexample:From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al132ExempleFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al133MementoWithoutviolatingencapsulation,captureandexternalizeanobject'sinternalstatesothattheobjectcanberestoredtothisstatelater.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al134MementoStructure…From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al135Memento…PreservingencapsulationboundariesItsimplifiesOriginatorUsingmementosmightbeexpensive.DefiningnarrowandwideinterfacesHiddencostsincaringformementosFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al136CaseStudyFrom?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al137Designproblems…Documentstructure.ThechoiceofinternalrepresentationforthedocumentaffectsnearlyeveryaspectofLexi'sdesign.Allediting,formatting,displaying,andtextualanalysiswillrequiretraversingtherepresentation.Thewayweorganizethisinformationwillimpactthedesignoftherestoftheapplication.
Formatting.HowdoesLexiactuallyarrangetextandgraphicsintolinesandcolumns?Whatobjectsareresponsibleforcarryingoutdifferentformattingpolicies?Howdothesepoliciesinteractwiththedocument'sinternalrepresentation?
From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al138Designproblems…Embellishingtheuserinterface.Lexi'suserinterfaceincludesscrollbars,borders,anddropshadowsthatembellishtheWYSIWYGdocumentinterface.SuchembellishmentsarelikelytochangeasLexi'suserinterfaceevolves.Henceit'simportanttobeabletoaddandremoveembellishmentseasilywithoutaffectingtherestoftheapplication.
Supportingmultiplelook-and-feelstandards.Lexishouldadapteasilytodifferentlook-and-feelstandardssuchasMotifandPresentationManager(PM)withoutmajormodification.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al139Designproblems…Embellishingtheuserinterface.Lexi'suserinterfaceincludesscrollbars,borders,anddropshadowsthatembellishtheWYSIWYGdocumentinterface.SuchembellishmentsarelikelytochangeasLexi'suserinterfaceevolves.Henceit'simportanttobeabletoaddandremoveembellishmentseasilywithoutaffectingtherestoftheapplication.
Supportingmultiplelook-and-feelstandards.Lexishouldadapteasilytodifferentlook-and-feelstandardssuchasMotifandPresentationManager(PM)withoutmajormodification.From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al140Designproblems…Spellingcheckingandhyphenation.HowdoesLexisupportanalyticaloperationssuchascheckingformisspelledwordsanddetermininghyphenationpoints?Howcanweminimizethenumberofclasseswehavetomodifytoaddanewanalyticaloperation?From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al141From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al142From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al143From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al144From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al145From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al146From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al147From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al148From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al149From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al150From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al151From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al152From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al153From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al154From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al155From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al156From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al157Summary(C.Alexander)Itispossibletomakebuildingbystringingtogetherpatterns,inaratherlooseway.Abuildingmadelikethis,isanassemblyofpatterns.Itisnotdense.Itisnotprofound.Butitisalsopossibletoputpatternstogetherinsuchwaythatmanypatternsoverlapinthesamephysicalspace:thebuildingisverydense;ithasmanymeaningscapturedinasmallspace;andthroughthisdensity,itbecomesprofound.158ArchitecturalPatterns…FromMUDtoStructure…Layers,PipeandFilters,BlackboardDistributedSystems…Broker,PipeandFilters,MicrokernelInteractiveSystems…MVC,PACAdaptableSystems…Microkernel,Reflection…159Layerhelpstostructureapplicationthatcanbedecomposedintogroupsofsubtasksinwhicheachgroupofsubtasksisataparticularlevelofabstraction.160Layer:examples161Layer:Structure162Layer:Structure163Layerandcomponents…164LayerandFacadeDP…165LayerandFacadeDP166Layers:VariantsRelaxedLayeredSystem:Alayer?
j
?canuseserviceofj-1,j-2…AlayercanbepartiallyopaqueSomeservicetolayerj+1,otherstoallupperservices…Layeringthroughinheritance:LowerlayersareimplementedasbaseclassesHigherlevelcanoverridelowerlevel…167Layers:KnownUsesVirtualmachines:JVMandbinarycodeformatAPI:LayerthatencapsulateslowerlayersInformationSystemPresentation,Applicationlogic,DomainLayer,DatabaseWindowsNT(relaxedfor:kernelandIOandhardware)Systemservices,Resourcemanagement(Objectmanager,securitymonitor,processmanager,I/Omanager,VMmanager,LPC),Kernel(exceptionhandling,interrupt,multiprosynchro,threads),HAL(HardwareAbstractionLevel)Hardware168Layers:benefitsReuseoflayersSupportforstandardization(POSIX)DependenciesarekeptlocalExchangeabilities:ReplacementofoldimplementationwithAdapterPatternDynamicexchangewithBridgePattern169Layers:LiabilitiesCascadesofchangingbehaviorLowerefficiencyUnnecessarywork:functionsofalayercalledmanytimesforoneserviceDifficultyofestablishingcorrectgranularityoflayers:Tofewlayer->lessbenefits,tomuchlayer->complexityandoverhead…170PipesandFiltersProvidesastructureforsystemsthatprocessastreamofData.Eachprocessingstepisencapsulatedinafiltercomponent.Dataispassedthroughpipesbetweenadjacentfilters.Recombiningfiltersallowstobuildfamiliesofrelatedsystems.171PipesandFilters:Example172PipesandFilters:Structure173PipesandFilters174PipesandFilters:pushpipeline175PipesandFilters:pullpipeline176PipesandFilters:push-pullpipeline177PipesandFilters:ThreadedFilters178PipesandFilters:KnownUsesUnixCMSPipelines(extensionIBMmainframes)LASSPTools(NumericalAnalysis)Graphicalinputdevices(knobsorsliders)FiltersfornumericalanalysisanddataextractionDatasinkstoproduceanimationfromnumericaldatastreams…Khoros:Imagerecognition…WEB!!Servlet!!179PipesandFiltersbenefitsNointermediatefilenecessary(butpossible)FlexibilitybyfilterexchangeFlexibilitybyrecombinationReuseoffiltercomponentsRapidprototypingofpipelineEfficiencybyparallelprocessing180PipesandFiltersLiabilitiesSharingstateinformationisexpensiveorinflexibleEfficiencygainbyparallelprocessingisoftenanillusion
Costofdatatransfer,filtersthatconsumealldatabeforeoneoutput,contextswitchononecomputer,synchronizationoffiltersviapipesDatatransformationoverheadErrorHandling181[SunDeveloppers]From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al182From?
SystemofPatterns
?Buschmann&Alland?
DesignPattern
?Gamma&Al183Blackboard TheBlackboardarchitecturalpatternisusefulforproblemsforwhichnodeterministicsolutionstrategiesareknown.Severalspecializedsubsystemsassembletheirknowledgetobuildapossiblypartialorapproximatesolution.184BlackboardExample185BlackboardStructure186BlackboardStructure187BlackboardStructure188BlackboardVariantsProductionSystem(OPSLanguage)Blackboard:workingmemoryKnowledgesource:Condition-actionrulesControl:conflictresolutionmodule.
Repository:
blackboard:Data,
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 新疆理工學(xué)院《書(shū)法創(chuàng)作訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 新疆吐魯番市高昌區(qū)市級(jí)名校2025年高中第一次統(tǒng)考數(shù)學(xué)試題含解析
- 2025-2030年中國(guó)DC電子負(fù)載器行業(yè)投資價(jià)值分析及市場(chǎng)規(guī)模預(yù)測(cè)研究報(bào)告
- 新疆政法學(xué)院《地圖制圖學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 星海音樂(lè)學(xué)院《技巧翻騰》2023-2024學(xué)年第二學(xué)期期末試卷
- 2025至2031年中國(guó)竹炭工藝品行業(yè)投資前景及策略咨詢研究報(bào)告
- 廣東省佛山市南海區(qū)里水鎮(zhèn)達(dá)標(biāo)名校2024屆中考數(shù)學(xué)仿真試卷含解析
- 2024-2025車(chē)間職工安全培訓(xùn)考試試題帶答案(精練)
- 2024-2025安全標(biāo)準(zhǔn)化安全培訓(xùn)考試試題答案4A
- 2025廠里安全培訓(xùn)考試試題附完整答案(全優(yōu))
- 百融云創(chuàng)風(fēng)險(xiǎn)決策引擎V5產(chǎn)品操作手冊(cè)
- 2020-2021年全國(guó)小升初語(yǔ)文真題匯編專題03字形(解析版)
- 順豐控股成本控制現(xiàn)狀及問(wèn)題分析
- 2024年山東省濟(jì)南市市中區(qū)九年級(jí)中考二模數(shù)學(xué)試題 (原卷版+解析版)
- 醫(yī)療質(zhì)量信息數(shù)據(jù)內(nèi)部驗(yàn)證制度
- 南寧市永安村發(fā)展規(guī)劃方案
- 國(guó)測(cè)省測(cè)四年級(jí)勞動(dòng)質(zhì)量檢測(cè)試卷
- 再回首合唱簡(jiǎn)譜
- 匠作匠場(chǎng)手風(fēng)滇南“一顆印”民居大木匠作調(diào)查研究
- 2024年中國(guó)人保財(cái)險(xiǎn)全系統(tǒng)廣西分公司招聘筆試參考題庫(kù)含答案解析
- 交警酒駕案件培訓(xùn)課件
評(píng)論
0/150
提交評(píng)論