Coder Social home page Coder Social logo

designpattern's Introduction

DesignPattern

Jungle设计模式系列

How to compile

Windows

mkdir build
cd build
cmake -G "MinGW Makefiles" ../
make

Linux

mkdir build
cd build
cmake ../
make

感谢

感谢@ichdream, @sterben-01对本项目的贡献,也欢迎和支持更多coder提出修改和指正

订正

  • 2021/10/28:GB2312 --> UTF-8
  • 2021/09/07:merge @ichdream pull request,采用智能指针管理堆对象,引入makefile管理工程,修改文件编码格式
  • 2021/04/04:为虚基类添加虚析构函数,避免内存泄露
  • 2020/11/29:解决内存泄露问题
  • 2023/09/24:添加CMake编译工程管理
  • 2024/04/17: update markdown note.

目录

代码资源:https://github.com/FengJungle/DesignPattern

01.设计模式——设计模式概述

02.设计模式(二)——UML类图介绍

03.设计模式(三)——面向对象设计原则

04.设计模式(四)——简单工厂模式

05.设计模式(五)——工厂方法模式

06.设计模式(六)——抽象工厂模式

07.设计模式(七)——建造者模式

08.设计模式(八)——原型模式

09.设计模式(九)——单例模式

10.设计模式(十)——适配器模式

11.设计模式(十一)——桥接模式

12.设计模式(十二)——组合模式

13.设计模式(十三)——装饰模式

14.设计模式(十四)——外观模式

15.设计模式(十五)——享元模式

16.设计模式(十六)——代理模式

17.设计模式(十七)——职责链模式

18.设计模式(十八)——命令模式

19.设计模式(十九)——解释器模式

20.设计模式(二十)——迭代器模式

21.设计模式(二十一)——中介者模式

22.设计模式(二十二)——备忘录模式

23.设计模式(二十三)——观察者模式

24.设计模式(二十四)——状态模式

25.设计模式(二十五)——策略模式

26.设计模式(二十六)——模板方法模式

其他

27.设计模式那么多!面试官会怎么问?

博客地址:https://zhuanlan.zhihu.com/p/415609134

28.划重点:面试中单例模式的考点!(C++版本)

博客地址:https://zhuanlan.zhihu.com/p/692662459

29.new也可以创建对象,为什么需要工厂模式?

博客地址:https://zhuanlan.zhihu.com/p/611234726

30.Qt中的设计模式

博客地址:https://blog.csdn.net/sinat_21107433/article/details/120936720

31.PImpl模式

博客地址:https://zhuanlan.zhihu.com/p/692661653

32.啊,如何遵循“低耦合”设计原则?

博客地址:https://zhuanlan.zhihu.com/p/473171832

designpattern's People

Contributors

fengjungle avatar ichdream avatar sterben-01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

designpattern's Issues

【文件编码格式问题】linux平台下中文乱码

image

开发环境为:ubuntu x_86_64
编译器:gcc/g++

经过排查发现,是因为代码文件的编码为GB2312

作者应该是在Windows上开发的吧,那么为了兼容,后续要不要改为utf-8文件格式?

我改了格式后,问题解决了。

flyweight pattern 享元模式优化

直接用静态对象生成NetDeviceFactory 不是更直观吗?

static NetDeviceFactory& getFactory(){ static NetDeviceFactory instance; return instance; }

返回一个静态实例即可
这样NetDeviceFactory类就不用特意定义一个静态变量了。
static NetDeviceFactory* instance; // 可以取消
效果也是一样的。
不知道我说的对不对,就胡乱发在这里了哈。

重复析构

05.PrototypePattern/2.Code/main.cpp
#53 delete jungleModel;

主函数中析构了jungleModel
而在jungleWork的析构函数中又一次析构了jungleModel。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.