《设计模式、数据结构及架构.pdf》由会员分享,可在线阅读,更多相关《设计模式、数据结构及架构.pdf(6页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、架构、设计模式、数据结构架构、设计模式、数据结构李建奇V1.02011110V1.12011310 抽象是最重要的架构技能一一.首先要理解业务 首先要理解业务?先作,数据流图,状态图?数据驱动设计?再理解 业务的特点,请求的分布二二.用有限的资源战胜价值 用有限的资源战胜价值(需求需求),关键是平衡和抉择关键是平衡和抉择?架构要抽象掉细节。?首先设定资源限制,其次才设计?理解 feature 的重要程度。三三.不要让细节,麻痹最重要的架构决定 不要让细节,麻痹最重要的架构决定和“道”一样,架构图,好像谁都可以做。架构师,不是设计师,更不是程序员。四四.架构师需实现核心原形系统 架构师需实现核心
2、原形系统五五.要简化问题,但是不要太简单 要简化问题,但是不要太简单,balanceEssentialcomplexityrepresentsthedifficultyinherentinanyproblem.六六.技能 技能?Importantskill:abilitytoestimateperformanceofasystemdesign withoutactuallyhavingtobuildit!?理解系统每个模块的实现,Understandeverycomponentsimplementation.?知道的东西要多,这样,架构的时候,就有选择七七.Philosophyanddisci
3、pline?Beawareofcontext?Extrememaintenance?Bepragmatic?PreferDescriptiontocoding?Extremeabstract:Programtoaninterface(abstraction),notanimplementation?Extremeseparationofconcerns?Extremereadability?Testability?Nosideeffect?Donotrepeatyourself八八.DesignPrincipleDIP,dependencyinversionofcontrolOCP,openc
4、lose LSP,liskovsubstitute ISP,interfacesegregation SRP,singleresponsibility LKP,Leaseknowledgeprinciple九九.DataStructure&algorithms 算法是软件的核心。1logNNnLongN Dividedandconqueror RbtreeB+tree 十十.ArchitecturepatternStructurepattern Hierarchal,上层的东西,要抽象掉下层的差异。PipesandfilterMicrokernelBroker BlackBoardInterp
5、reter Connectionpattern:DirectRPC AsynchronousRPC Messagequeueserver Publishsubscribe MessageBroker(informationbus)十一十一.Architecturetactic HowtoconquerqualityattributeScalabilitytactic a)Stretch key dimensions(10X 20X)to see what breaks b)Bottleneck must be IO(disk and net)AvailabilitytacticModifiab
6、ilitytacticPerformancetactica)Speedupdataconversionb)Occupyrecourseasshortaspossiblec)Batchoperationd)MinimizeremotecallsandotherI/OTestabilitytacticUsabilitytactic1.Restartable 2.Allow rollbacks to previous versionsAllow rollbacks to previous versions.Necessary in case of an error in an update.3.Mo
7、nitor and instrument everything,and give enough fault information for diagnosisMonitor and instrument everything,and give enough fault information for diagnosis.Save more information than e.g.just A query has failed.Save query,time,error message and if possible the state of the application.4.Make ev
8、erything configurableMake everything configurable.Make diagnosis options configurable,rather than adding them when a system is failing.Adding monitoring to a failing system is asking for problems.十二十二.DesignpatternConstructionBehaviorStructure?antipattern、badsmellLongmethodDiversechangeRepeatedcodeT
9、alktostrangerPrematureOptimization十三十三.languagesErlangAssembleCC+JavaPythonScalaPhp Bewareofdifferentprogramparadigms.十四十四.Architectsfuturefocus软件设计思想的发展逻辑,大致是提高抽象程度,separation of concern 程度。fn(design)=fn1(abstraction)+fn2(separation of concern).由于大规模数据处理时代的来临,下一代设计范式的重点:1.将是如何提高 distributed(-concurrent)programming 的抽象程度 和 separation of concern 程度。2.dsl,按照以上的公式,也确实是一个好的方向。十五十五.Reference你的灯亮着吗jeffdean 冒号课堂郑晖http:/en.wikipedia.org/wiki/Programming_paradigm
限制150内