《软件工程实践者的研究方法课件》由会员分享,可在线阅读,更多相关《软件工程实践者的研究方法课件(30页珍藏版)》请在金锄头文库上搜索。
1、1Chapter 8nDesign ConceptsSoftware Engineering: A Practitioners Approach, 7/e by Roger S. PressmanEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright
2、 2009 by Roger Pressman. 2DesignnGood software design should exhibit:nFirmness(稳定性): A program should not have any bugs that inhibit its function. nCommodity(适用性): A program should be suitable for the purposes for which it was intended. nDelight(令人愉快): The experience of using the program should be p
3、leasurable one.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 3Analysis Model = Design ModelEvaluation only.Created with
4、 Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 43 Characters of Design Qualitythe design must implement all of the explicit(明确的) requirements contai
5、ned in the analysis model, and it must accommodate all of the implicit(隐含的) requirements desired by the customer.the design must be a readable, understandable guide for those who generate code and for those who test and subsequently support the software.the design should provide a complete picture(全
6、貌) of the software, addressing the data, functional, and behavioral domains from an implementation perspective.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Sli
7、des copyright 2009 by Roger Pressman. 5Quality GuidelinesA design should exhibit an architecture that (1) has been created using recognizable architectural styles or patterns, (2) is composed of components that exhibit good design characteristics and (3) can be implemented in an evolutionary fashion
8、A design should be modular; that is, the software should be logically partitioned into elements or subsystemsA design should contain representations of data, architecture, interfaces, and components.A design should lead to data structures that are appropriate for the classes to be implemented.A desi
9、gn should lead to components that exhibit independent functional characteristics.A design should lead to interfaces that reduce the complexity of connections between components and with the external environment.A design should be derived using a repeatable method that is driven by information obtain
10、ed during software requirements analysis.A design should be represented using a notation that effectively communicates its meaning.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (Mc
11、Graw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 6Design PrinciplesThe design should be traceable to the analysis model. The design should not reinvent(彻底改造) the wheel. The design should “minimize the distance” between the software and the problem as it exists in the real world. The design
12、should exhibit uniformity and integration. The design should be structured to accommodate change. The design should be assessed for quality as it is being created, not after the fact. The design should be reviewed to minimize conceptual (semantic) errors.Design is not coding, coding is not design. F
13、rom Davis DAV95Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 7Fundamental ConceptsnAbstractiondata, procedurenArchitect
14、ure(架构)the overall structure of the softwarenPatternsconveys(承载) the essence(精髓) of a proven design solutionnModularitycompartmentalization(划分) of data and functionnInformation hidingcontrolled interfacesnFunctional independencesingle-minded function and low couplingnAspectsa mechanism for understan
15、ding how global requirements affect designnRefactoring(重构)a reorganization technique that simplifies the designnDesign Classesprovide design detail that will enable analysis classes to be implementedEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd
16、.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 8Data Abstractiondoordoorimplemented as a data structuremanufacturermanufacturermodel numbermodel numbertypetypeswing directionswing directioninsertsinsertslightslightsweight
17、weightopening mechanismopening mechanismEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 9Procedural Abstractionopenopenim
18、plemented with a knowledge of the object that is associated with enterdetails of enter details of enter algorithmalgorithmEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill
19、, 2009) Slides copyright 2009 by Roger Pressman. 10Architecture“The overall structure of the software and the ways in which “The overall structure of the software and the ways in which that structure provides conceptual integrity for a system.”that structure provides conceptual integrity for a syste
20、m.”Structural properties. This aspect of the architectural design This aspect of the architectural design representation defines the components of a system (e.g., modules, representation defines the components of a system (e.g., modules, objects) and the manner in which those components are packaged
21、 and objects) and the manner in which those components are packaged and interact with one another. For example, objects encapsulate both data interact with one another. For example, objects encapsulate both data and the processing that manipulates the data. and the processing that manipulates the da
22、ta. Extra-functional properties. The architectural design description The architectural design description should address how the design architecture achieves requirements for should address how the design architecture achieves requirements for performance, capacity, reliability, security, adaptabil
23、ity, and other performance, capacity, reliability, security, adaptability, and other system characteristics.system characteristics.Families(族族) of related systems. The architectural design should The architectural design should draw upon repeatable patterns that are commonly encountered in the draw
24、upon repeatable patterns that are commonly encountered in the design of families of similar systems. The design should have the design of families of similar systems. The design should have the ability to reuse architectural building blocks. ability to reuse architectural building blocks. Evaluation
25、 only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 11ArchitecturenIn the simplest form, architecture is the structure or organization
26、of program components(modules), the manner in which these components interact, and the structure of data that are used by the components. nIn a broader sense, components can be generalized to represent major system elements and their interactions.Evaluation only.Created with Aspose.Slides for .NET 3
27、.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 12Modularitynmodularity is the single attribute of software that allows a program to be intellectually manageable. nMonolithic
28、(整块庞大的) software (i.e., a large program composed of a single module) cannot be easily grasped() by a software engineer. nThe number of control paths, span of reference(引用跨度) , number of variables, and overall complexity would make understanding close to impossible. nIn almost all instances, you shou
29、ld break the design into many modules, hoping to make understanding easier and as a consequence, reduce the cost required to build the software.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Appr
30、oach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 13Modularity: number of modules What is the right number of modules What is the right number of modules for a specific software design?for a specific software design?optimal numberoptimal number of modules of modules cost of cost
31、 of software softwarenumber of modulesnumber of modulesmodulemoduleintegrationintegrationcostcostmodule development cost module development cost Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners App
32、roach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 14Why Information Hiding?nreduces the likelihood of “side effects”nlimits the global impact of local design decisionsnemphasizes communication through interfacesndiscourages the use of global datanleads to encapsulationan attrib
33、ute of high quality designnresults in higher quality softwareEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 15Informatio
34、n Hidingmodulemoduleinterfaceinterfacesecretsecret algorithm algorithm data structure data structure details of external interface details of external interface resource allocation policy resource allocation policyclientsclientsa specific design decisiona specific design decisionEvaluation only.Crea
35、ted with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 16Sizing Modules: Two ViewsEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro
36、.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 17Functional IndependencenFunctional independence is achieved by developing modules with single-minded function and an aversion to excessiv
37、e interaction with other modules.nCohesion(内聚性) is an indication of the relative functional strength of a module.nA cohesive module performs a single task, requiring little interaction with other components in other parts of a program. Stated simply, a cohesive module should (ideally) do just one th
38、ing. nCoupling(耦合性) is an indication of the relative interdependence among modules.nCoupling depends on the interface complexity between modules, the point at which entry or reference is made to a module, and what data pass across the interface.Evaluation only.Created with Aspose.Slides for .NET 3.5
39、 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 18AspectnAn aspect is a representation of a cross-cutting concern. (横切关注点: 利用“横切”技术,剖开封装的对象内部,将那些影响多个类的公共行为封装成一个可重用对象,称为Aspect)。
40、 nConsider two requirements A and B. B crosscuts A if a software decomposition has been chosen in which A cannot be satisfied without taking B. nAOP(Aspect Oriented Programming)是OOP的补充和完善。n如:业务处理的主要流程是核心关注点,与之关系不大的部分是横切关注点, 如权限认证、日志、事务处理等,可以将核心关注点和横切关注点分离开来。Evaluation only.Created with Aspose.Slides
41、 for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 19显示更新的需求:显示更新的需求:无论图元何时移动、无论图元何时移动、移动到哪里,都要移动到哪里,都要通知屏幕管理器通知屏幕管理器(Display)其位)其位置发生了改变。置发生了改变。Aspect - ExampleEvalu
42、ation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 20 采用采用OOPOOP,典型做法是在每个移动图元的操作代码中,插入一段通知,典型做法是在每个移动图元的操作代码中,插入一段通知Display其位置发生改
43、变的代码,即:调用其位置发生改变的代码,即:调用Display.update( )。Class Line private Point _p1,_p2; Point getP1( ) return _p1; Point getP2( ) return _p2; void setP1(Point p1)this._p1=p1; Display.update( ); void setP2(Point p2)this._p2=p2; Display.update( ); Class Point private int _x1,_x2; int getX( ) return _x1; int getY(
44、 ) return _x2; void setX (int x1)this._x1=x1; Display.update( ); void setY(int x2)this._x2=x2; Display.update( ); Aspect - ExampleEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McG
45、raw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 21Aspect DisplayUpdatingPointcut move(): call(void Line.setP1(Point)| call(void Line.setP2(Point)| call(void Point.setX(int)| call(void Point.setY(int); after() returning:move()Display.update(); Class Line private Point _p1,_p2; Point getP1( )
46、 return _p1; Point getP2( ) return _p2; void setP1(Point p1)this._p1=p1; void setP2(Point p2)this._p2=p2; Class Point private int _x1,_x2; int getX( ) return _x1; int getY( ) return _x2; void setX (int x1)this._x1=x1; void setY(int x2)this._x2=x2; 采用采用AOPAOP,典型做法是在将所有移动图,典型做法是在将所有移动图元的代码封装成一个元的代码封装成
47、一个Aspect: Aspect: DisplayUpdating 。Aspect - ExampleEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 22AspectAn ExamplenCon
48、sider two requirements for the SafeHomeA WebApp. Requirement A is described via the use-case Access camera surveillance via the Internet. A design refinement would focus on those modules that would enable a registered user to access video from cameras placed throughout a space. Requirement B is a ge
49、neric security requirement that states that a registered user must be validated prior to using SafeHomeA. This requirement is applicable for all functions that are available to registered SafeHome users. As design refinement occurs, A* is a design representation for requirement A and B* is a design
50、representation for requirement B. Therefore, A* and B* are representations of concerns, and B* cross-cuts A*. nAn aspect is a representation of a cross-cutting concern. Therefore, the design representation, B*, of the requirement, a registered user must be validated prior to using SafeHomeA, is an a
51、spect of the SafeHome WebApp. Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 23RefactoringnRefactoring is the process of
52、 changing a software system in such a way that it does not alter the external behavior of the code design yet improves its internal structure.nWhen software is refactored, the existing design is examined for nredundancynunused design elementsninefficient or unnecessary algorithmsnpoorly constructed
53、or inappropriate data structuresnany other design failure that can be corrected to yield a better design.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides co
54、pyright 2009 by Roger Pressman. 24The Design ModelEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 25Design Model Elements
55、nData elementsnData model - data structuresnData model - database architecturenArchitectural elementsnApplication domainnAnalysis classes, their relationships, collaborations and behaviors are transformed into design realizationsnInterface elementsnComponent elementsnDeployment elementsEvaluation on
56、ly.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 26Architectural ElementsnThe architectural model is derived from three sources: ninfor
57、mation about the application domain for the software to be built; nspecific requirements model elements such as data flow diagrams or analysis classes, their relationships and collaborations. nthe availability of architectural patterns. Evaluation only.Created with Aspose.Slides for .NET 3.5 Client
58、Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 27Interface Elements(1)user interface (2)external interfaces to other systems, devices. -include checking and definitive information abo
59、ut the information is sent or received (3) internal interfaces between various design components. -an interface is a set of operations that describes some part of the behavior of a class and provides access to these operations. Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyr
60、ight 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 28Interface ElementsEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software En
61、gineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 29Component Elementsncomponent-level design defines data structures for all local data objects and algorithmic detail for all processing that occurs within a component and an interface that allows a
62、ccess to all component operations.Evaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman. 30Deployment ElementsnIndicate how soft
63、ware functionality and subsystems will be allocated within the physical computing environmentEvaluation only.Created with Aspose.Slides for .NET 3.5 Client Pro.Copyright 2004-2011 Aspose Pty Ltd.软件工程实践者的研究方法Software Engineering: A Practitioners Approach, 7/e (McGraw-Hill, 2009) Slides copyright 2009 by Roger Pressman.