【文档说明】1-软件体系结构概念.课件.ppt,共(72)页,2.064 MB,由小橙橙上传
转载请保留链接:https://www.ichengzhen.cn/view-50406.html
以下为本文档部分文字说明:
1SoftwareArchitecture软件体系结构起源、定义、意义和研究现状张平健华南理工大学软件学院2Examplesfromarchitecture–Kennel建筑的例子——狗舍一个人搭建,需要•最小化建模•简单的过程•简
单的工具3Examplesfromarchitecture–House建筑的例子——住房一个团队高效和适时地建造,需要•仔细的建模•良好定义的过程•良好的工具4Examplesfromarchitecture–Skyscraper建筑的例
子——摩天大楼5ExamplesfromOrganization–One-manCompany机构组织的例子——家庭作坊6ExamplesfromOrganization–MiddletoSmallsizedCompany机构组织的例子——中小公司7Examp
lesfromOrganization–InternationalGroup机构组织的例子——跨国集团8SoftwareDevelopment–Single-handed软件开发——单枪匹马9Softwa
reDevelopment–TeamWork软件开发——团队开发10SoftwareDevelopment–LargeComplicatedSystems软件开发——大型复杂系统的开发11SoftwareCrisis软件危机Softwaresystemsbecomeslargeraswellas
morecomplex,thereliabilityissuebecomesmoreandmoreserious.Softwarecrisisbeginstoburst(爆发).Projectsrunover-budgeta
ndover-time.Projectswereunmanageableandthecodesweredifficulttomaintain.Softwareoftendidnotmeetrequirements.12EmergeofSoftwareEngineering(SE
)软件工程的诞生Theterm"softwarecrisis"wascoinedbyF.L.BaueratthefirstNATOSoftwareEngineeringConferencein1968atGarmisch,Germany.1968年在德国召开的NATO(Nor
thAtlanticTreatyOrganization,北大西洋公约组织)会议上首次提出了“软件工程”概念,希望用工程化的原则和方法来克服软件危机13What’sEngineering?什么是“工程”?EngineeringmeansSolvepro
blematlowestcostGuidedbyscientificknowledgeEquippedwithmethodologyReliedonsuitabletoolsPurpose:Letordinarypersonbeabletodowhatcanonlyb
eaccomplishedbyexpertinthepast14EvolutionofEngineering工程的进化15StagesofEngineering工程化的步伐手工(Craft)商业(Comm
erical)工程(ProfessionalEngineering)行家里手和业余天才熟练的工匠受过系统教育的专业人员直觉与强力既定程序分析与理论偶然的进步注重实效地优化以科学为指导地升级换代不经意的推广言传身教专业教育课程奢侈地使用原料注
重成本与原料利用原料多次利用生产是为了使用而不是出售为销售而生产市场份额16SE的发展17UnderstandingofSA软件架构认识与实践Program=Datastructure+Algorithm程序=数据结构+算法P
rogram=Object+Object程序=对象+对象System=Component+Component系统=构件+构件System=Element+Connector系统=组件+连接件Overallstructure>Technicaldetails整体结构>技术细节
Qualities>Functionalities性能>功能SOA,MDA,SaaS(Softwareasaservice)...ERP(企业级应用)、E-Business/Digital-Government(电子商务/电子政务/电子交易)、GridCom
puting网格、CloudComputing云计算…18OriginofSAConceptsStudiesonSAdatedbackto1960’s,withfocusonsoftwarestructure.1969年,Brooksproposedtheconceptof―arch
itecture‖toseparatedesignfromimplementation.Theterm―architecture‖wasfirstusedtomeanadescriptionofacomputersystemthatappliedeq
uallytomorethanoneactualsystem19OriginofSAConcepts1968年,EdsgerDijkstraproposedtheideaoflayersForexample,programswithinOScanbeclassifiedintodifferen
tlayers,onlyprogramsinneighboringlayerscanaccesseachother.Organizedinthisway,systemdevelopmentandmaintenancecanbesimplifiedgreatly.20Ori
ginofSAConcepts1970年代初,DavidParnasproposedaseriesofimportantideas1972年,信息隐蔽(information-hiding)1974年,软件结构(softwarestructures)1975年,程序家族(
programfamilies)Aprogramfamilyisasetofprogramswhosecommonpropertiesaresoextensivethatitisadvantageoustost
udythosepropertiesbeforeinvestigating(调查)individualmembers.21OriginofSAConcepts1976年,FrankDeRemerandHansKronpro
posedMIL75(模块连接语言)“Programming-in-largeversusprogramming-in-small‖,[IEEETrans.onSE,June1976]22OriginofSAConceptsProgrammingintheLarge
(PITL)structuringlargecollectionsofmodulestobuildsystemsdevelopingindividualmodulesMegaprogramming-Aconceptualsoftwaredevel
opmentframeworkthatunitesanumberofideascomponent-baseddevelopmentsoftwarereuseproduct-linesFormalMethod=SpecificationLanguage(
规格语言)+FormalReasoningTransformationalSystemsreduceprogramminglabor,improveprogramreliability,andupgrade(使上升)programperformance23
FormationofSASA的形成Researchworkcarriedoutin1990’sDewaynePerryandAlexanderWolfDavidGarlanandMaryShawSAstylesDSSA1995GoFpublished―Des
ignPatterns‖1994RationalRosereleasedumlsuits1995TheMythicalMan-Monthreprinted2425DefinitionsofSA―T
hereisnostandard,universally-accepteddefinitionoftheterm,forsoftwarearchitectureisafieldinitsinfancy(初期),althoughitsrootsrundeepins
oftwareengineering.‖http://www.sei.cmu.edu/architecture/definitions.html26DefinitionsofSALenBass,PaulClements,RickKazman
定义Thesoftwarearchitectureofaprogramorcomputingsystemisthestructureorstructuresofthesystem,whichcomprise(由..组成)softwareelements,theexternallyvisib
lepropertiesofthoseelements,andtherelationshipsamongthem.27DefinitionsofSABooch,Rumbaugh,andJacobson,1999:Anarchitectureisthesetofsigni
ficantdecisionsabouttheorganizationofasoftwaresystem,theselectionofthestructuralelementsandtheirinterf
acesbywhichthesystemiscomposed,togetherwiththeirbehaviorasspecifiedinthecollaborations(合作)amongthoseelements,thecompositionofthesestruct
uralandbehavioralelementsintoprogressivelylargersubsystems,andthearchitecturalstylethatguidesthisorganization---theseelementsandt
heirinterfaces,theircollaborations,andtheircomposition(TheUMLModelingLanguageUserGuide,Addison-Wesley,1999).28DefinitionsofSAPerryandWolf,1992:Aset
ofarchitectural(or,ifyouwill,design)elementsthathaveaparticularform.PerryandWolfdistinguishbetweenprocessingelements,
dataelements,andconnectingelements,andthistaxonomy(分类学)byandlargepersiststhroughmostotherdefinitionsandapproaches.29Definit
ionsofSAGarlanandShaw,1993:...beyondthealgorithmsanddatastructuresofthecomputation;designingandspecifyingtheoverallsystemstructuree
mergesasanewkindofproblem.Structuralissuesincludegrossorganizationandglobalcontrolstructure;protocolsforcommunication,synchronization,anddataaccess;a
ssignmentoffunctionalitytodesignelements;physicaldistribution;compositionofdesignelements;scalingandperformance;andselectionamongdesignalternatives."
30DefinitionsofSAGarlanandShaw’sdefinitioncanbesimplifiedasArchitecture=Components+Connectors+Constrains体系结构=组件+连接件+约束31EvolutionofSA(SA的发展)198
0’sUseinformalBox-and-linediagrams使用非正式的框图Reliesonexpert’speculiarexperiences依靠专家的特定经验Adoptsporadical
lyarchitecturestyles不规范、多样地使用体系结构模式和风格1990’sRealizethevalueofSA认识到了体系结构的价值Requiredocumentingandreviewingarchitecture开发过程
中要求体系结构文档,并开始体系结构评审ProductsforSAdesignandintegrationemerge产品化、商业化的体系结构标准和组件集成框架开始出现Standardizevocabular
y,symbolsandtoolsinSAdesign规范化体系结构设计中的词汇、符号和工具PublishbooksonSA软件体系结构的书籍和课程32CurrentStatus(1)发展现状1SAdesi
gnisnotunderstoodthoroughlybydevelopers体系结构设计只是被开发人员含糊地理解ItisdifficulttocarryoutconsistencyandintegrityanalysisofSAdesign难以对体系结构设计作出一致性或完整性的分析
Asitevolves,thesystemisdifficulttocomplywithoriginalarchitecture随着系统的演化,难以保持同系统原有体系结构的一致Lackeffectivetoolstoassist(帮助)indesign,an
alysisandvalidationonarchitecture难以开发有效的工具,辅助人们进行体系结构的设计、性质分析和验证33CurrentStatus(2)发展现状(2)DoDemphasizesSA-centeredsoftwa
rereuse在“软件复用的展望和策略”[DoD1992]报告中,美国国防部强调了“以体系结构为中心的复用”在整个软件生存周期中,对于软件开发和支持的重要性。ListofresearchprojectsonSA:
STARS,DODCARDS,DODPRISM,DODRAPIDE,StanfordUni.C2styleandADL,CaliforniaUni.ABLECMUACMEArchitectureInterchangeLang
uage,CMUVitruvius,CMU34CurrentStatus(3)发展现状(3)ActiveresearchtopicsinSA当前软件体系结构研究和实践中,一些最活跃的领域包括:Compilationofva
riousarchitecturestyles各种体系结构风格的汇编和总结ArchitectureDescriptionLanguage体系结构描述语言FormalfoundationofSA体系结构的形式化基础AnalysistechniquesofSA体系结构分析技术SA
-baseddevelopment基于体系结构的开发方法SAinverseengineering体系结构重建和再工程ToolsandenvironmentforSAdesign支持体系结构设计的工具和环境DSSA特定领域的软件体系结构35FutureDirectionsFo
rmalmethodsforarchitecturesInformationexchangeamongvariousADLsIntelligent(智能的)designtoolsandenvironmentsSoftwarearchitectureengineeringEvoluti
onofarchitectures36EnvisioningSA预想软件架构SAisinfluencedbyavarietyofenvironmentalfactors商业、技术、组织等环境因素影响架构Inreturn,SAinfluencesenvironment反过来,架构影响环境37
TheArchitectureBusinessCycle(ABC)ABCiscycleofinfluences,fromtheenvironmenttothearchitectureandbacktothe
environment.Thebusiness/organizationalenvironmentnecessarilyaffectsarchitecturaldesigndecisions.Thesoftwarearchitecture
inturnchangesthebusinessenvironment.Architecturaldesignispartofeverystepofthedevelopmentprocess.Theseinfluencesstr
onglyaffecttheorganization’sbottomline.38TheEnvironmentInfluencesDesignsStakeholdersinasoftwaredevelopmenteffortEndusersCustom
ersDevelopersProjectmanagerMaintainersMarketingstaff…Everystakeholderhasadifferentsetofconcerns,e.g.,runtime
behavior,hardwarecompatibility(兼容性),andsoon.Thedifferentstakeholders’concernsmaycontradict(反驳)eachothe
randmaychangeduringtheproject.3940AttributesImportanttoDifferentStakeholdersPerformanceandresourceutilizationCultur
aladaptibilityReliabilityanddataintegrityModifiabilityandmaintainabilityUsabilityandinteroperabilityTes
tabilityPlatformcompatibilityAvailabilitySecurityBehavior…41BusinessEnvironmentandOrganizationalStructureImmediatebusiness
(短期)influencesareexistingassetslikearchitecturesandproductsbasedonthemthatinfluencedesigndecisions.Long-te
rmbusiness(长期的)influencesarestrategicgoalsfortheorganization,suchasinfrastructure(基础设施)development,thatinfluencedesigndec
isions.Organizationstructureinfluencesarchitecturewhennecessaryspecializedexpertiseexistsordoesnotexistwithintheorganization.42TheArchitect’sBack
groundandExperienceSuccessfulpreviousexperiencesmakearchitectswanttoreusethesuccessfulstrategyNegativepreviousexperiencesma
kearchitectswanttoavoidusinganapproachagainPriorexposure(暴露)topreviousarchitecturalpatternsorothereducationcaninfluencethearchitectS
tandardindustrypracticesinthearchitect’sprofessionalcommunity,e.g.,Web-based,object-oriented,middleware-backedin
formationsystemdesigns,willplayastrongrole43Influencesonthearchitecture44TheArchitectureBusinessCycle45ArchitectureDesignChanget
heBusinessEnvironmentTheyaffectthestructureoftheorganization.Theyaffectthebusinessgoalsoftheorganization.Theyaffectcust
omerrequirementsfornewproducts.Theyaffecthowfuturearchitecturesaredesigned.46ArchitectureDesignChangetheBusinessEnvironm
entSoftwarearchitecturesaffectthestructureofsoftwaredevelopmentorganizations.Anarchitectureprescribes(规定)thesoftwareunitstobedeveloped.Thes
oftwareteamnormallyorganizesaccordingtothesoftwareunits.Teamstendtospecializeandbecomeembedded(嵌入式的)intheorganizationalst
ructure.47ArchitectureDesignChangetheBusinessEnvironmentSoftwarearchitectureseventuallyaffectthegoalsofasoftwaredevelopmentorganization.Aninitialent
ryintosomemarketisafootholdthatwillleadtonewopportunities.Anorganizationwillchooseopportunitiesthatbestcapitalize(使资本化)onexisting,proven
architectures.48ArchitectureDesignChangetheBusinessEnvironmentSoftwarearchitecturesalsoaffectcustomerrequirementsfornewproducts.An
existingproduct’sarchitecturecanserveasthefoundationforaproductline.Customersrecognizethepotentialforlow
eredcostsandfastertimetomarketthroughreuseofanexistingarchitecture.Customersmaybewillingtorelaxfunctionalrequirement
sinordertoachievethesebenefits.49SAAffectstheDevelopmentProcessSoftwarearchitectureisanimportantcomponentofthelargeroverallsoftwaredevelopmen
tprocess.CreatingthebusinesscaseUnderstandingrequirementsCreatingorselectingthearchitectureCommunicatingthearchitectureAnalyzingoreva
luatingthearchitectureImplementingbasedonthearchitectureEnsuringconformancetothearchitecture50SAAffectstheDevelopmentProcessArchitectu
ralknowledgeisessentialforunderstandingtheconstraints(约束)andassumptions(假设)involvedinmakingabusinesscaseforaproduct:Co
stCustomermarketTargetedtimetomarketInterfacestoothersystemsLimitations51SAAffectstheDevelopmentProcessRequiremen
tsengineeringUsecases/ScenariosRapidprototyping(样机研究)FinitestatemachinemodelsFormalspecificationsNormally,determiningacomplete
setofrequirementswillneedatleastareferencearchitecture,soaniterativerequirementsengineeringprocessisalmostalways
necessary52SAAffectstheDevelopmentProcessArchitecturalanalysistechniqueshelpsoftwareteamsevaluateanarchitectureArchitec
tstypicallyconsidermultiplecompetingdesigns.Inattribute-drivendesign,candidatearchitecturesareevaluatedaccordingto
theirabilitytosupportdesiredqualityattributes.OnemethodforcomparingarchitecturesistheArchitectureTrade
offAnalysisMethod(ATAM)fromtheCMUSoftwareEngineeringInstitute.53SAAffectstheDevelopmentProcessSoftwarearchitectsneedtoensurethattheimplementatio
nremainsfaithfultothearchitecturaldesign.Thearchitecturaldesignneedstobecommunicatedeffectivelytothedevelopers.Architectsneedtomonit
orthedevelopmentprocess.Ifpossible,thedevelopmentinfrastructureshouldenforceconformancetothearchitecturespecifications.Asthearchitecturematuresand
evolves,itmustbekeptsynchronizedwiththedesigndocumentation.Inthecasethatproperdesigndocumentationdoesnotexist
,softwarearchitecturereconstructiontoolsmaybeuseful.54SAAffecttheBottomLineAnarchitect’sdesigndecisionshavelong-termfinancialconse
quencesforasoftwaredevelopmentorganization.Thearchitecturehasapivotalroleinthesoftwaredevelopmentprocess.Ithasabigimpactonasy
stem’sabilitytomeetqualitygoals.Itsupports(ordoesn’tsupport)reuseatmultiplelevels.55SAAffecttheBottomLineThearchitectur
eiscommonabstractionthatallstakeholderscanuseformutualunderstanding.We’vealreadyseen,architecturaldesigndecisionshaverepercussionsthroughoutthedev
elopmentcycle.Changingthearchitectureduringthedesignphaseiseasy;it’smuchharderlater.Thearchitectureseverelyconstrainsthedeta
iledsoftwaredesign.Thearchitectureprofoundlyaffectstheplanning,schedule,andbudgetfortheentireproject.56SAAffecttheBottomLineHavingtheright
architectureiscrucialformeetingqualitygoals.Performancemightdependonthevolumeofinter-elementcommunication.Modifiabilityrequiresseparationo
fconcernsinthearchitecture.Securityrequiresarchitecturalelementsforaccesscontrol.Scalabilityrequiresarchite
cturalbreakdownwherecertainelementscanbereplicatedorreplacedwithhigher-performanceversions.Reusabilityrequirescomponentswithouttoomanyattachment
stothesurroundingenvironment57WhyIsArchitectureSoImportant?CommunicationamongstakeholdersCapturesearlydesigndecisionsTransferableabstra
ctionofthesystem58Architecture&DesignDecisionsDefinesconstraintsonimplementationRelatedtoorganizationalstructureEnablesQualityattributes(e.
g.,performance,safety,security)AllowssystemspropertiestobepredictedHelpsevolutionaryprototypingHelpsreasonaboutchangeCostandsche
dulingestimates59ATransferable,ReusableModelSoftwareproductlinesshareacommonarchitectureBuildusinglarge,externallydevelopedpiecesRestrictvocabula
ryofdesignchoicestominimizedesigncomplexityPermitstemplate-baseddevelopment60ResponsibilitiesofArchitectsGuidethetechnicaldirectionsManageconfli
ctinginfluencesMinimizeunforeseendifficulties61GuidethetechnicaldirectionsConvertcustomerrequirementsintoatechni
caldesignEnsurethatthetechnicaldesignmeetsqualityrequirementsCommunicatewithstakeholdersthroughdetailedtechnicalpresentationsListentostakeho
ldersandbuildconsensusReviewdevelopercodeandensureconformancetothearchitectureandgoodcodingpracticesServeasamentorfordevelopers62Ma
nageConflictingInfluencesThearchitectmustidentifythestakeholders.Thearchitectmustengagethestakeholderstosolicittheirnee
dsandexpectations.Thearchitectshouldusearchitecturereviewsanditerativeprototypingasmeanstosolicitthesen
eedsandexpectations.6364TypicalDesignTrade-offsFunctionalityvs.UsabilityPerformancevs.ModifiabilityCostvs.Robustne
ssEfficiencyvs.PortabilityRapiddevelopmentvs.FunctionalityCostvs.ReusabilityBackwardCompatibilityvs.Readability65MinimizeUn
foreseenDifficultiesCasestudiesofsuccessfularchitecturesgivecluesaboutthebestapproachtoanewproblemandarerichsourcesofdesignpatterns.Architecturalas
sessment(beforethesystemisbuilt)helpsdeterminewhichcompetingdesignalternativesarebetter.Incrementalarchitecture-baseddevelopmenthelpstouncoverd
esignflawsbeforetheykillaproject.66AsuccessfulsoftwarearchitectshouldBeanexcellentprogrammerwithsignificantdesignandimplementationexper
ience.Stayup-to-datewithnewtoolsandtechnologies,andknowrelevantdesignpatternsandanti-patterns.Beagoodpolitician,negotiator
,andcommunicatorwhocanspeakthelanguagesofthebusinessteamandthetechnicalteam.-Youtypicallyneedseveralyearsofprofessionalexperiencetobealeads
oftwarearchitectinamaturesoftwaredevelopmentorganization.67ChiefArchitectBillGatesactedasthechiefarchitectofMicrosoft.丁磊68BestPracticesinSADesign
Thearchitectureshouldbetheproductofonearchitect(orafewarchitectswithadefinedleader).Thearchitectshouldbegivenfunctionalrequ
irementsandaprioritizedlistofnon-functionalrequirementsorqualityattributes(security,modifiability,andsoon)
thatneedtobesatisfied.Thearchitectureshouldbedocumentedfrommultipleperspectiveswellenoughtofacilitatecommu
nicationandunderstandingbetweenallstakeholders.Thearchitectureshouldbecirculatedtothesystem’sstakeholdersandt
heyshouldparticipateactivelyinanarchitecturereview.69BestPracticesinSADesignThearchitectureshouldbeanaly
zedforquantitativemeasureslikemaximumthroughputandformallyevaluatedforqualityattributesbeforeitistoolatet
ochangethearchitecture.Itshouldbepossibletoimplementa―skeletal‖versionofthearchitecturewherecommunicationis
exercisedbutfunctionalityisminimal.Thisallowsforincrementalgrowth.Resourcecontentionareasshouldbeidentifi
edandresolved,andthesolutionshouldbespecified,circulated,andmaintained.70RecommendationsforStructuringSoftwareThearchitectu
reshouldbecomposedofwell-definedmodulesthatutilizetheprinciplesofinformationhiding(encapsulation)andseparationofconcerns.Themodulessh
ouldhideanyidiosyncrasiesoftheexistingcomputinginfrastructure.Eachmoduleshouldhaveawell-definedinterfacee
ncapsulatingorhidingimplementationstrategiesanddatastructures.Qualityattributesshouldbeachievedusing
well-knownarchitecturalpatternswiththeirassociatedtactics.71RecommendationsforStructuringSoftwareThearchitectureshouldnotdependonfunction
alityofaspecificversionofacommercialproductortool.Ifcommercialtoolsareunavoidable,thearchitecturemustbestructur
edsothatchangingthetoolhasminimalimpactontherestofthesystem.Modulesproducingdatashouldbeseparatefrommodulesthatconsu
medata.Thisimprovesmodifiabilitywhenchangesareconfinedtotheproducerorconsumer.Forparallelarchitectures,thethreadsshouldbe
carefullyspecifiedseparatelyfromthemodules,sinceaprocessmightexecuteinmorethanonemodule.72RecommendationsforStructuringSoftwareThreadsshouldbe
writtensotheycaneasilymigratefromoneprocessortoanother.Thecompletesetofinteractionpatternsshouldbesmall,simple,andwell-defined.T
heresultingconceptualintegrityinthearchitecturewillleadtosmoothdevelopment..