Design Principle设计原则 最近由于碰到要参与设计一个音频处理系统,有人提议用一个大的全局变量结构体来做状态信息交流的地方,引起了我对设计一个系统的思考,于是找到了如下资料,当然,关于这个系统也是有待验证,不能说全局变量就是不好,因为这个系统并不会并发执行,而且资源充足. 我反正有点疑虑,但是会继续验证. 以下为Gof的六大设计原则,出自<设计模式>. Single Responsibility Principle -SRP There should never be more…
Design Principle vs Design Pattern设计原则 vs 设计模式 来源:https://www.tutorialsteacher.com/articles/difference-between-design-principle-and-design-pattern In software engineering, design principle and design pattern are not the same.在软件工程中,设计原则和设计模式是不同的. Des…
Single Responsibility Principle 类的设计趋向于:Use Case Diagram --> (derived) --> Detail Open-Closed Principle /* Software entities should be open for extension, but closed for modification */ 反面例子:Dependency: 作为参数,作为局部变量,调用静态方法. 改进方式:增加抽象类或者接口,以及set方法. Li…
https://refactoring.guru/smells/feature-envy https://stackoverflow.com/questions/1242994/effective-c-sharp-tips Inversion of control <= https://en.wikipedia.org/wiki/Inversion_of_control <= https://en.wikipedia.org/wiki/Template_method_pattern 如何创…
Classes are the building blocks of your java application. If these blocks are not strong, your building (i.e. application) is going to face the tough time in future. This essentially means that not so well-written can lead to very difficult situation…
From Head First Design Patterns. Design Principle: Idnetify the aspects of your application that vary and separate them from what stays the same. Here's another way to think about it: Take the parts that vary and encapsulate them, so that later you c…