资源描述
Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,These slides are designed to accompany,Software Engineering:A Practitioners Approach,7/e,(McGraw-Hill,2009).Slides copyright 2009 by Roger Pressman.,*,Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,*,1,Chapter 10,Component-Level Design,Software Engineering:A Practitioners Approach,7/e,by Roger S.Pressman,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,1Chapter 10Component-Level Des,1,2,What is a Component?,OMG Unified Modeling Language Specification,OMG01 defines a component as,“a modular,deployable,and replaceable part of a system that encapsulates implementation and exposes a set of interfaces.”,”,OO view:,a component contains a set of collaborating classes,Conventional view:,a component contains processing logic,the internal data structures that are required to implement the processing logic,and an interface that enables the component to be invoked and data to be passed to it.,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,2What is a Component?OMG Unifi,2,3,OO Component,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,3OO ComponentEvaluation only.,3,4,Conventional Component,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,4Conventional ComponentEvaluat,4,5,Conventional Component,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,5Conventional ComponentEvaluat,5,6,Basic Design Principles,Open-Closed Principle(开闭原则).,“A module component should be open for extension but closed for modification.,Substitution Principle(替换原则).,“Subclasses should be substitutable for their base classes.,Dependency Inversion Principle(依赖倒置原则).,“Depend on abstractions.Do not depend on concretions(具体实现).”,Interface Segregation Principle(接口分离原则).,“,Many,client-specific interfaces(专用接口)are better than,one,general purpose interface.,Release Reuse Equivalency Principle(发布复用等价原则).,“The granule(粒度)of reuse is the granule of release.”,Common Closure Principle(共同封装原则).,“Classes that change together belong together.(同时变更的类应封装在一起)”,Common Reuse Principle(共同重用原则).,“,Classes that arent reused together should not be grouped together.”,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,6Basic Design PrinciplesOpen-C,6,7,Design Guidelines,Components,Naming conventions should be established for components that are specified as part of the architectural model and then refined and elaborated as part of the component-level model,Interfaces,Interfaces provide important information about communication and collaboration(as well as helping us to achieve the OPC),Dependencies and Inheritance,it is a good idea to model dependencies from left to right and inheritance from bottom(derived classes)to top(base classes).,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,7Design GuidelinesComponentsEv,7,8,Cohesion(内聚度),Conventional view:,the“single-mindedness”of,a module,OO view:,cohesion,implies that a component or class encapsulates only attributes and operations that are closely related to one another.,Levels of cohesion(内聚度依次递减),Functional,Layer,Communicational,Sequential,Procedural,Temporal,设计目标:模块内各动作的内聚度越高越好。,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,8Cohesion(内聚度)Conventional vie,8,9,Coupling(耦合度),Conventional view:,The degree to which,a module is connected to other modules,and to the external world,OO view:,a qualitative measure of the degree to which classes are connected to one another,Level of coupling(耦合度依次递减),Content,Common,Control,Data,Routine call,External,设计目标:模块之间的耦合度越底越好。,Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,9Coupling(耦合度)Conventional vie,9,10,Component Level Design-I,Step 1.Identify all,design classes,that correspond to the,problem domain,.,Step 2.Identify all,design classes,that correspond to the,infrastructure domain,.(for example,GUI component,OS components),Step 3.Elaborate all design classes that are not acquired as reusable components,including the,message,interface,attribute and operation,.,Step 3a.Specify,message details,when classes or component collaborate.(Collaboration Diagram with messages is shown),Evaluation only.,Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.,Copyright 2004-2011 Aspose Pty Ltd.,10Component Level Design-IStep,10,11,Component Level Design-I,Step 3b.Identify appropriate,interfaces,for each component.,下图为Prin
展开阅读全文