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所有,你可以任意转载但同时应该注明出处。欢迎评论,不服来辩。
  • 相关阅读:
    intellij idea 为JavaEE项目建立Servlet
    DNS无响应
    取消Gridvie中button的焦点
    android.os.NetworkOnMainThreadException
    java.net.MalformedURLException: Protocol not found:
    Failure [INSTALL_FAILED_OLDER_SDK]
    android library projects cannot be launched
    CDQ分治的嵌套
    CDQ分治入门
    最远 Manhattan 距离
  • 原文地址:https://www.cnblogs.com/noiplee/p/3595169.html
Copyright © 2011-2022 走看看