简体   繁体   English

开源项目中的C ++类设计模式

[英]C++ class design patterns in open source projects

I have recently started learning design patterns. 我最近开始学习设计模式。 I have understood the basics of few patterns. 我已经理解了几种模式的基础知识。 Now I want to get familiar with some real code examples where these patterns are being utilized. 现在我想熟悉一些使用这些模式的真实代码示例。 Can somebody here please point out to some open source projects where design patterns are being used ? 有人可以指出一些使用设计模式的开源项目吗? I would like to see how design patterns are being used in real world code. 我想看看在现实世界的代码中如何使用设计模式。

Following are some of the links. 以下是一些链接。 JUnit Cookbook provides brilliant example of quite a few patterns - really worth checking. JUnit Cookbook提供了很多模式的精彩示例 - 非常值得检查。

  1. JUnit Cook's Tour JUnit库克之旅
  2. Vince Huton's DP 文斯赫顿的DP
  3. Design PAtterns 设计PAtterns

Hope that helps. 希望有所帮助。

Well, this is tooting my own horn a bit, but an Open Source project I'm working on makes extensive use of the factory method pattern . 好吧,这是我自己的角,但我正在研究的一个开源项目大量使用工厂方法模式 I implement the guts of the pattern itself here as a set of templates, define a factory here , register a subclass for that factory here , and use the factory to instantiate objects here . 我实现这个模式本身的胆量在这里为一组模板,定义一个工厂在这里 ,注册该工厂的子类在这里 ,并使用工厂来实例化对象这里

IMHO, ACE (Adaptive Communication Environment) can be a good example. 恕我直言, ACE(自适应通信环境)可以是一个很好的例子。 It also uses c++ templates with design patterns, which is also pragmatical. 它还使用带有设计模式的c ++模板,这也是实用的。 This framework takes basis of Pattern-Oriented Software Architecture: Patterns for Concurrent and Networked Objects book, which is also a good reference for design patterns, besides GoF 该框架采用面向模式的软件架构:并发和网络对象模式的基础,除了GoF之外,它也是设计模式的一个很好的参考

In the book by GOF which you are probably reading, for each Design Pattern they provide a REAL code example, I mean not the sample code, but they actually say in which projects each DP has been used. 在你可能阅读的GOF书中,对于每个设计模式,他们提供了一个真实的代码示例,我的意思不是示例代码,但他们实际上说的是每个DP使用的项目。 Those projects are mostly OpenSource. 这些项目大多是OpenSource。 HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM