软件设计.docVIP

  • 18
  • 0
  • 约 5页
  • 2017-09-29 发布于山西
  • 举报
Software Design What is a design, what is a good design Basic design principles: loose coupling, high cohesion (Command-Query Separation), avoid duplication, design for change (Open-Closed Principle) What is a design patterns and why Basic design patterns: Adapter, Singleton, Iterator, Command, Factory Method How each pattern is implemented What is a design? A plan or blueprint about how to build a software system. A design identifies the major components and their interconnections A design is an abstraction that describes overall structure of a system. 2、What is a good design? A good design should be functionally correct,efficient,robust,simple,easy to understand,easy to maintain,easy to use,easy to extend. A good design should avoid duplication, display high cohesion and loose coupling. What are the Basic design principles loose coupling:coupling refers to the degree to which different units depend on each other.Two classes are tightly coupled if they depend closely on many details of each other. Loose coupling improves readability and maintainability High Cohesion: Cohesion refers to the number and diversity of tasks that a single unit is responsible for. High Cohesion:Each unit should do one thing and do it well High cohesion makes it easier to Understand class and methods.reuse a class and method.give descriptive names to a class or method High cohesion-method: Command-Query Separation Principle: In general, a query method should not have side effects and a modifier method should not return any value. avoid duplication: two kinds of duplication:syntactic duplication semantic duplication the problem duplication bring:1:waste of time 2:hard to maintain design for changes:Try to anticipate what changes are likely to be made in the future. Open-Closed Principle: Software entities should be open for extension, but closed for modification.(即:extend by adding new classes or extending without modifying existing classes,宁加勿改) What is design patterns

文档评论(0)

1亿VIP精品文档

相关文档