9

Hi I am learning Design patterns these days. I want to read design pattern used in various projects and how it is implemented. Implementation is helpful to connect the design pattern in broader picture and why they deiced to use that pattern. Problem with open source projects are they are not documented properly.

Can anone help me with sm online resource?

PS: if possible i need in c or C++

UPDATE: projects that are listed below :
http://www.boost.org
http://sourceforge.net/projects/loki-lib/
'POCO.'
ACE (The Adaptive Communication Environment).

If anyone want to add more please do. Personaly i looked at the above projects and found boost to be a good choice to start.

UPDATE: Due to a nice post on java which describe design pattern Examples of GoF Design Patterns in Java's core libraries .I am including some other languages in tag as well that i know

Community
  • 1
  • 1
ashmish2
  • 2,885
  • 8
  • 40
  • 54
  • this probably belongs at programmers.stackexchange.com not stackoverflow.com as it isn't a programming question. – CashCow Feb 18 '11 at 09:20
  • 9
    Note that patterns do not magically improve the quality of your code. – fredoverflow Feb 18 '11 at 10:23
  • @Fred could u please elaborate. In which sense you mean quality here? (efficiency, resuability, readability ... ) – ashmish2 Feb 18 '11 at 10:30
  • 11
    Any measure of quality you can imagine. Patterns are not a panacea. I once wrote a Tetris game with about 100 classes that incorporated all the patterns I knew at the time. Why use a simple if/else if you can use a *pattern*? OO is good, and patterns are even better, right? No, it was a terrible, *over-engineered* piece of crap. – fredoverflow Feb 18 '11 at 10:36
  • Same feeling as FredOverflow. Even though there are situations where patterns are good, I once was about to write a tool to detect if a string was already localized or not in a bunch of java property files. This tool was started by my boss and used all bunch of guru stuff to write it, like 20 classes, factory pattern, singleton, visitor, you name it. All this for a simple tool that turned out another team in the project already had done in about 100 lines of ruby code. – Carlos Blanco Feb 18 '11 at 22:10
  • fredoverflow What makes you think your tetris app was properly designed? Yourself stated that it was over engineered. If you have 100 classes in a tetris app then patterns aren't the problem. – EmilCataranciuc May 04 '18 at 15:11

3 Answers3

5

boost, a very well written and documented library implements several design patterns. it's quite a large library, and these implementations are used in the libraries.

http://www.boost.org

boost is found in many projects, but loki's also worth reading:

http://sourceforge.net/projects/loki-lib/

the original author of loki (Andrei Alexandrescu) went over many of the design details in a c++ classic Modern C++ Design: Generic Programming and Design Patterns Applied.

justin
  • 104,054
  • 14
  • 179
  • 226
  • in C++ one has patterns (although this term is not as widely used as in eg. the java world), but one has **idioms** too, which are as bad as patterns. Boost mainly implements idioms, not patterns. – Alexandre C. Feb 18 '11 at 10:12
  • @Alexandre C. we've policies too! – justin Feb 18 '11 at 10:32
2

There are many libraries which make a good use of patterns, but let me point you to two that seems very good to me:

  • ACE (The Adaptive Communication Environment). Open-source object-oriented (OO) framework that implements many core patterns for concurrent communication software.
  • POCO. Open source C++ class libraries and frameworks for building network- and internet-based applications that run on desktop, server and embedded systems.

Of course, as Justin said, Boost can also be a source of learning.

David
  • 2,663
  • 3
  • 24
  • 41
2

I found a very helpful examples of how/where is particular pattern used under the java tag (it shouldn't be to hard to understand it): Examples of GoF Design Patterns in Java's core libraries

Community
  • 1
  • 1
sinek
  • 2,458
  • 3
  • 33
  • 55