All Projects → liu-jianhao → Cpp Design Patterns

liu-jianhao / Cpp Design Patterns

C++设计模式

Programming Languages

cpp
1120 projects

Projects that are alternatives of or similar to Cpp Design Patterns

Design Patterns In Kotlin
Design Patterns implemented in Kotlin
Stars: ✭ 5,009 (+582.43%)
Mutual labels:  design-patterns
Entitas Csharp
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Stars: ✭ 5,393 (+634.74%)
Mutual labels:  design-patterns
Clean Ts Api
API em NodeJs usando Typescript, TDD, Clean Architecture, Design Patterns e SOLID principles
Stars: ✭ 619 (-15.67%)
Mutual labels:  design-patterns
Circlebar
A fun, easy-to-use tab bar navigation controller for iOS.
Stars: ✭ 513 (-30.11%)
Mutual labels:  design-patterns
Sml
SML: C++14 State Machine Library
Stars: ✭ 540 (-26.43%)
Mutual labels:  design-patterns
Javamtp
《Java多线程编程实战指南(设计模式篇)》源码
Stars: ✭ 575 (-21.66%)
Mutual labels:  design-patterns
Cloud Design Patterns
Prescriptive Architecture Guidance for Cloud Applications
Stars: ✭ 484 (-34.06%)
Mutual labels:  design-patterns
Design Patterns Php
Design Pattern Examples in PHP
Stars: ✭ 682 (-7.08%)
Mutual labels:  design-patterns
Java design patterns
Java 实现的面向对象设计模式示例, 创建者、抽象工厂、工厂方法、原型、单例、适配器、桥接、组合、装饰器、备忘录、观察者、状态、策略、模板方法、访问者
Stars: ✭ 547 (-25.48%)
Mutual labels:  design-patterns
Node.js design patterns second edition code
Code repository for Node.js Design Patterns Second Edition, published by Packt
Stars: ✭ 617 (-15.94%)
Mutual labels:  design-patterns
Rust Design Pattern
rust design patterns
Stars: ✭ 529 (-27.93%)
Mutual labels:  design-patterns
Designpatterns
经典设计模式讲解以及项目实战(Java版)
Stars: ✭ 540 (-26.43%)
Mutual labels:  design-patterns
Rude Java
Java Practice Projects. 以Java语言为主的各种项目实践,涵盖各个业务、各个功能,并附上高质量文章讲解,其中一些甚至可以单开一个仓库。让你再也不用寻找各种框架demo、项目脚手架。
Stars: ✭ 583 (-20.57%)
Mutual labels:  design-patterns
Modular Monolith With Ddd
Full Modular Monolith application with Domain-Driven Design approach.
Stars: ✭ 6,210 (+746.05%)
Mutual labels:  design-patterns
Iosdesignpatternsamples
This is Github user search demo app which made by many variety of design patterns. You can compare differences in MVC, MVP, MVVM and Flux.
Stars: ✭ 622 (-15.26%)
Mutual labels:  design-patterns
Designpatternslibrary
A comprehensive design patterns library implemented in C#, which covers various design patterns from the most commonly used ones to the lesser-known ones. Get familiar with and learn design patterns through moderately realistic examples.
Stars: ✭ 485 (-33.92%)
Mutual labels:  design-patterns
Cp Ddd Framework
A lightweight flexible development framework for complex business architecture with full ecosystem!轻量级业务中台开发框架,中台架构的顶层设计和完整解决方案!
Stars: ✭ 566 (-22.89%)
Mutual labels:  design-patterns
Ltupatternfactory
Lambda the ultimate Pattern Factory: FP, Haskell, Typeclassopedia vs Software Design Patterns
Stars: ✭ 735 (+0.14%)
Mutual labels:  design-patterns
Rest Api Design Guide
NBB's REST-ish API Design Guide
Stars: ✭ 643 (-12.4%)
Mutual labels:  design-patterns
Coordinator
Implementation of Coordinators app design pattern.
Stars: ✭ 616 (-16.08%)
Mutual labels:  design-patterns

C++设计模式

什么是设计模式

“每一个模式描述了一个在我们周围不断重复发生的问题,以及该问题的解决方案的核心。这样,你就能一次又一次地使用该方案而不必做重复劳动”。 ——Christopher Alexander

如何解决复杂性?

  • 分解
    • 人们面对复杂性有一个常见的做法:即分而治之,将大问题分解为多个小问题,将复杂问题分解为多个简单问题。
  • 抽象
    • 更高层次来讲,人们处理复杂性有一个通用的技术,即抽象。由于不能掌握全部的复杂对象,我们选择忽视它的非本质细节,而去处理泛化和理想化了的对象模型。

面向对象设计原则

  1. 依赖倒置原则(DIP)
  • 高层模块(稳定)不应该依赖于低层模块(变化),二者都应该依赖于抽象(稳定) 。
  • 抽象(稳定)不应该依赖于实现细节(变化) ,实现细节应该依赖于抽象(稳定)。
  1. 开放封闭原则(OCP)
  • 对扩展开放,对更改封闭。
  • 类模块应该是可扩展的,但是不可修改。
  1. 单一职责原则(SRP)
  • 一个类应该仅有一个引起它变化的原因。
  • 变化的方向隐含着类的责任。
  1. Liskov 替换原则(LSP)
  • 子类必须能够替换它们的基类(IS-A)。
  • 继承表达类型抽象。
  1. 接口隔离原则(ISP)
  • 不应该强迫客户程序依赖它们不用的方法。
  • 接口应该小而完备。
  1. 优先使用对象组合,而不是类继承
  • 类继承通常为“白箱复用”,对象组合通常为“黑箱复用” 。
  • 继承在某种程度上破坏了封装性,子类父类耦合度高。
  • 而对象组合则只要求被组合的对象具有良好定义的接口,耦合度低。
  1. 封装变化点
  • 使用封装来创建对象之间的分界层,让设计者可以在分界层的一侧进行修改,而不会对另一侧产生不良的影响,从而实现层次间的松耦合。
  1. 针对接口编程,而不是针对实现编程
  • 不将变量类型声明为某个特定的具体类,而是声明为某个接口。
  • 客户程序无需获知对象的具体类型,只需要知道对象所具有的接口。
  • 减少系统中各部分的依赖关系,从而实现“高内聚、松耦合”的类型设计方案。

从封装变化角度对模式分类

组件协作:

单一职责:

对象创建:

对象性能:

接口隔离:

状态变化:

数据结构:

行为变化:

领域问题:

总结

现代较少用的模式

  • Builder
  • Mediator
  • Memento
  • Iterator
  • Chain of Resposibility
  • Command
  • Visitor
  • Interpreter
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].