Architecture and Design Guidlines.

来源:互联网 发布:windows下载中心在哪 编辑:程序博客网 时间:2024/05/21 19:55

 Key Design Principles

When getting started with your design, bear in mind the key principles that will help you to create architecture that meets “best practices,” minimizes costs and maintenance requirements, and promotes usability and extendibility. The key principles are:


Separation of concerns.(问题分离) Break your application into distinct features that overlap in functionality as little as possible.
Single Responsibility Principle. (单一责任原则)Each component or a module should be responsible for only a specific feature or functionality.
Principle of least knowledge.  (最少知识原则) A component or an object should not know about internal details of other components or objects. Also known as the Law of Demeter (LoD).
Don’t Repeat Yourself (DRY). (不要重复自己)There should be only one component providing a specific functionality; the functionality should not be duplicated in any other component.
Avoid doing a big design upfront. (避免一开始就做很大的设计)If your application requirements are unclear, or if there is a possibility of the design evolving over time, avoid making a large design effort
prematurely. This design principle is often abbreviated as BDUF.
Prefer composition over inheritance.(多用组合,少用继承) Wherever possible, use composition over inheritance when reusing functionality because inheritance increases the dependency between parent and child classes, thereby limiting the reuse of child classes.

原创粉丝点击