Design Principle设计原则

最近由于碰到要参与设计一个音频处理系统,有人提议用一个大的全局变量结构体来做状态信息交流的地方,引起了我对设计一个系统的思考,于是找到了如下资料,当然,关于这个系统也是有待验证,不能说全局变量就是不好,因为这个系统并不会并发执行,而且资源充足。 我反正有点疑虑,但是会继续验证。

以下为Gof的六大设计原则,出自《设计模式》。

Single Responsibility Principle -SRP

There should never be more than one reason for a class to change.

Open Closed Principle – OCP

Software entities like classes, modules and functions should be open for extension but closed for modifications.

Liskov Substitution Principle - LSP

Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.

Least Knowledge Principle - LKP

Only talk to you immediate friends.

Interface Segregation Principle - ISP

The dependency of one class to another one should depend on the smallest possible interface.

Dependence Inversion Principle - DIP

High level modules should not depends upon low level modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions.

剩下的个人认为是非常简单实用。

Don't repeat yourself – DRY

Keep it simple and stupid – KISS

High Cohesion and Low Coupling – HCLC

Design by Contract - DBC

You aren't gonna need it - YAGNI

参考的文章:

http://www.cnblogs.com/areliang/archive/2006/03/07/345111.html

设计原则 Design Principle的更多相关文章

  1. Design Principle vs Design Pattern 设计原则 vs 设计模式

    Design Principle vs Design Pattern设计原则 vs 设计模式 来源:https://www.tutorialsteacher.com/articles/differen ...

  2. 设计模式-设计原则(Design Principle)

    本文由@呆代待殆原创,转载请注明出处. 写在前面:所谓设计原则并不是一定要遵守的法则,只是一种建议,因为保持这些原则本身会有一定代价,若是这些代价超过了带来的好处就得不偿失了,所以一切还是以简单为准. ...

  3. 设计原则:开-闭原则(Open-Closed Principle, OCP)

    开-闭原则就是软件实体应当对扩展开放,对修改关闭.(Software entities should be open for extension,but closed for modification ...

  4. 面象对象设计原则之六:迪米特原则(LeastKnowledge Principle, LKP)

    迪米特法则来自于1987年美国东北大学(Northeastern University)一个名为“Demeter”的研究项目.迪米特法则又称为最少知识原则(LeastKnowledge Princip ...

  5. 面象对象设计原则之五:依赖倒置原则(The Dependency Inversion Principle,DIP)

    如果说开闭原则是面向对象设计的目标的话,那么依赖倒转原则就是面向对象设计的主要实现机制之一,它是系统抽象化的具体实现.依赖倒转原则是Robert C. Martin在1996年为“C++Reporte ...

  6. 面象对象设计原则之二:开放封闭原则(Open-Closed Principle, OCP)

    开闭原则是面向对象的可复用设计的第一块基石,它是最重要的面向对象设计原则.开闭原则由Bertrand  Meyer于1988年提出,其定义如下: 开闭原则(Open-Closed Principle, ...

  7. 面象对象设计原则之一:单一职责原则(Single Responsibility Principle, SRP)

    单一职责原则是最简单的面向对象设计原则,它用于控制类的粒度大小.单一职责原则定义如下:单一职责原则(Single Responsibility Principle, SRP):一个类只负责一个功能领域 ...

  8. 面向对象设计原则 开放封闭原则(Open Closed Principle)

    开放封闭原则(OCP,Open Closed Principle) 开放封闭原则是所有面向对象原则的核心. 软件设计本身所追求的目标就是封装变化.降低耦合,而开放封闭原则正是对这一目标的最直接体现. ...

  9. Android Wear - Design Principles for Android Wear(设计原则)

    ---------------------------------------------------------------------------------------------------- ...

随机推荐

  1. 【概率】poj 2096:Collecting Bugs

    Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other ...

  2. PAT-乙级-1031. 查验身份证(15)

    1031. 查验身份证(15) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 一个合法的身份证号码由17位地区. ...

  3. C++调用C#生成的DLL文件的各种问题

    C++调用C#生成的DLL文件: 首先选择建立一个C#的类库,然后再按照需求编写需要的函数 之后,对于C++调用过程需要注意的几点: 1.使用#using <....some.dll>指出 ...

  4. VMware linux与windows文件共享

    将要共享的文件做成一个iso文件,然后打开VMware

  5. cache设计,以及多核造成的不一致性以及解决方案

    http://www.360doc.com/content/11/1013/00/1317564_155625188.shtml http://blog.csdn.net/muxiqingyang/a ...

  6. “段寄存器”的故事[转](彻底搞清内存段/elf段/实模式保护模式以及段寄存器)

    http://blog.csdn.net/michael2012zhao/article/details/5554023 一. 段寄存器的产生 段寄存器的产生源于Intel 8086 CPU体系结构中 ...

  7. C#中种常用的计时器

    1.System.Timers.Timer和System.Windows.Forms.Timer,它的最低识别为1/18s. 2.timeGetTime,他的最低识别能达到5ms. 3.System. ...

  8. UNICODE,GBK,UTF-8区别

    简单来说,unicode,gbk和大五码就是编码的值,而utf-8,uft-16之类就是这个值的表现形式.而前面那三种编码是一兼容的,同一个汉字,那三个码值是完全不一样的.如"汉"的uncode值与g ...

  9. [.NET MVC进阶系列03] Views 视图基础

    [注:此文对应Chapter 3:Views] 一.View的功能: 1.View用来呈现页面UI,通过Controller来指定View: 要注意的是,MVC和以前基于文件的Web应用不同,URL指 ...

  10. 在.net中用Connection对象数据源的架构信息

    可得到数据库中的,表,视图,等信息   string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + fi ...