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所有,你可以任意转载但同时应该注明出处。欢迎评论,不服来辩。
  • 相关阅读:
    MongoDB 3.0安全权限访问控制(Windows版)
    MVC创建通用DropdownList
    当文字超出宽度,自动截取文字并加省略号
    JQuery Datatables(二)
    JQuery Datatables(一)
    PHP signal 信号
    phpunit 入门
    Wget 命令详解
    ubuntn下 apt的用法和yum的比较(转)
    navicat for mysql 安装
  • 原文地址:https://www.cnblogs.com/noiplee/p/3595169.html
Copyright © 2011-2022 走看看