Key Design Concepts
关键的设计概念
Managing complexity is the most important technical topic in software development.
管理的复杂性是软件开发中最重要的技术课题。
The goal of all software-design techniques is to break acomplicated problem into simple pieces. The more independent the subsystems are, the more you make it safe to focus on one bit of complexity at a time.
所有的软件设计技术的目标是打破复杂问题转化为简单的部分。更加独立的子系统,你越能集中在一个点一次安全的复杂性。
design characteristics
设计特点
Minimal complexity
最小的复杂性
* Avoid making “clever” designs. clever designs are usually hard to understand. Instead make “simple” and “easy-to-understand” designs.
*避免“聪明”的设计。聪明的设计通常是难以理解的。相反,使“简单”和“容易理解”的设计。
Ease of maintenance
维护方便
Loose coupling
松散耦合
Extensibility
可扩展性
Reusability
可重用性
High fan-in
高扇入
* having a high number of classes that use a given class. High fan-in implies that a system has been designed to make good use of utility classes at the lower levels in the system.
*具有大量的类,使用一个给定的类。高扇入意味着系统已经在系统中的低水平利用好实用类。
Low-to-medium fan-outside
低到中等风扇外
* having a given class use a low-to-medium number of other classes (<7)
*具有一个给定的类使用一个低的其他类介质数(<7)
Portability
可移植性
Leanness
消瘦
* designing the system so that it has no extra parts. a book is finished not when nothing more can be added but when nothing more can be taken away.
*设计系统使得它没有多余的部分。一本书没有完成时,没有什么可以说如果没有更多的可以带走。
Stratification
分层
* trying to keep the levels of decomposition stratified so that you can view the system at any single level and get a consistent view.
*尽量保持水平分层分解,使您可以查看系统在任何一个水平,得到一个一致的看法。
Standard techniques
标准技术
The steps in designing with objects
在设计对象的步骤
Identify the objects and their attributes (methods and data)
识别对象及其属性(方法和数据)
Determine what can be done to each object
决定什么可以做,每个对象
Determine what each object is allowed to do to other objects
确定每个对象可以做其他对象
Determine the parts of each object that will be visible to other objects-which parts will be public and which will be private.
确定零件的每个对象将是可见的其他对象的哪些部分将被公开,这将是私人的。
Define each object’s public interface
定义每个对象的公共接口
Form Consistent Abstractions
形成一致的抽象
Abstraction is the ability to engage with a concept while safely ignoring some of its details – handling different details at different levels.
抽象与概念的能力而安全地忽略一些细节的不同处理不同的细节–。
A good class interface is an abstraction that allows you to focus on the interface without needing to worry about the internal workings of the class.
一个好的类接口是一个抽象的概念,让你专注于接口,无需担心类的内部运作。
Design Building Blocks: Heuristics
积木:启发式算法设计
Encapsulate Implementation Details
封装实现细节
Encapsulate picks up where abstraction leaves off. you aren’t allowed to look at an object at any level of detail.
封装拿起抽象离开。你不可以看在任何级别的细节的对象。
Inherit – When Inheritance Simplifies the Design
–继承继承时的简化设计
Inheritance simplifies programming because you write a general routine to handle anything that depends on a door’s general properties and then write specific routines to handle specific operations on specific kinds of doors.
继承简化了编程,因为你写的去做任何事情,取决于门的一般性质,然后写具体的程序对特定类型的特定操作的门一般的常规处理。
Hide Secrets (Information Hiding)
隐藏秘密(信息隐藏)
Information hiding is part of the foundation of both structured design and object-oriented design. In structured design, the notion of “black boxes” comes from information hiding. In object-oriented design, it gives rise to the concepts of encapsulation and modularity and it is associated with the concept of abstraction.
信息隐藏技术是基础部分的结构化设计和面向对象设计。在结构设计中,“黑盒子”的概念来源于信息隐藏。在面向对象的设计,它增加了封装和模块化的概念,是抽象的概念,相关的。
One key task in designing a class is deciding which features should be known outside the class and which should remain secret.
在设计一个类是决定哪些功能应该知道班外,应保持秘密的一个关键任务。
Identify Areas Likey to Change
找出可能的变化
Accommodating changes is one of the most chanllenging aspects of good program design. The goal is to isolate unstable areas so that the effect of a change will be limited to one routine, class, or package.
适应变化是一个最具挑战性的方面良好的程序设计。我们的目标是隔离不稳定地区的这样一个变化的影响将是有限的一个例程,类,或包。
areas that are likely to change:
有可能改变地区:
Business rules
业务规则
Hardware dependencies
硬件的依赖性
Input and output
输入和输出
Nonstandard language features
不规范的语言特点
Keep Coupling Loose
保持松耦合
Coupling describes how tightly a class or routing is related to other classes or routines. The goal is to create classes and routines with small, direct, visible and flexible relations to other classes and routines.
描述如何紧密耦合类或路由到其他类或程序有关的。我们的目标是创建类和常规小,直接,可见柔性关系的其他类和例程。
Classes and routines are first and foremost intellectual tools for reducing complexity. If they’re not making your job simpler, they’re not doing thier jobs.
类和例程首先是降低复杂性的知识工具。如果他们不让你的工作更简单,他们没有做他们的工作。
Look for Common Design Patterns
寻找常见的设计模式
Popular Design Patterns
流行的设计模式
Abstract Factory
抽象工厂
Adapter
适配器
Bridge
桥
Composite
复合材料
Decorator
装饰
Facade
立面
Factory Method
工厂方法
Iterator
迭代器
Observer
观察员
Singleton
独生子女
Strategy
策略
Template Method
模板方法
Design Practices
设计实践
Iterate
迭代
Design is an iterative process. You don’t usually go from point A only to point B; you go from point A to point B and back to point A.
设计是一个迭代的过程。你通常不会去从A点到B点只有;你从A点到B点回到A点
Divide and Conquer
分而治之
no one’s skill is big enough to contain all the details of a complex program, and that applies just as well to design. Divide the program into different areas of concern, and then tackle each of those area individually.
没有一个人的能力是大到足以包含所有的复杂程序的细节,这同样适用于设计。把程序划分成不同领域的关注,然后解决这些地区单独。
Top-Down and Bottom-Up Design Approaches
自上而下和自下而上的设计方法
Top-down design begins at a high level of abstraction. You define base classes or other nonspecific design elements. As you develop the design, you increase the level of detail, identifying derived classes, collaborating classes, and other detailed design elements.
自顶向下设计的一个高层次的抽象开始。你定义的基类或其他非特异性的设计元素。当你开发设计,增加你的详细程度,确定派生类,合作类,和其他详细的设计元素。
Bottom-up design starts with specifics and works toward genealities. It typically begins by identifying concrete objects and then generalizes aggregations of objects and base classes from those specifics.
自下而上的设计始于对genealities细节和作品。它通常首先确定具体对象和概括的对象和基类聚合这些细节。
Experimental Prototyping
实验样机
Collaborative Design
协同设计
Capturing Your Design Work
捕捉你的设计工作
Insert design documentation into the code itself
插入到代码本身的设计文档
Capture design discussions and decisions on a wiki
捕捉设计的讨论和决定维基
Write e-mail summaries
写电子邮件的摘要
Use a digital camera
使用数码相机
Save design flip charts
保存设计挂图
Use CRC cards
使用CRC卡片
Create UML diagrams a
创建UML图
原文:http://blog.csdn.net/xiaoping0935/article/details/44782711