zoukankan      html  css  js  c++  java
  • 设计原则 Design Principle

    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

    内容来自http://www.cnblogs.com/noiplee/ ,版权归noiplee所有,你可以任意转载但同时应该注明出处。欢迎评论,不服来辩。
  • 相关阅读:
    arguments伪对象数组 javascript
    typeof获取变量的数据类型 javascript
    《转》Cucumber之一Cucumber概述——学习新篇章
    【转】Dubbo分布式服务框架
    SQL语句
    (转)面试必备之乐观锁与悲观锁
    多线程的实现方式
    Exception和RuntimeException区别
    实例化对象的两种方式
    包装类对象的比较
  • 原文地址:https://www.cnblogs.com/noiplee/p/3595169.html
Copyright © 2011-2022 走看看