I'm trying to improve my c++ coding technique by reading c++ source code. Which open source project would you recommend? Is the code of Boost C++ Libraries a good one?

  • 11
    Why close votes? The question is clear and concrete. May 31, 2012 at 17:23
  • STLs implementations May 31, 2012 at 18:53
  • 12
    @dukeofgaming: you forgot the "ironic" tag.
    – Doc Brown
    Jun 1, 2012 at 7:20
  • 1
    Well I guess the boost source code won't be that good an idea for a beginner. You will probably drown in templates and SFNINAE techniques you don't understand their workings and reasons yet. Jun 1, 2012 at 9:22
  • 7
    The close votes are because this question, while concrete, is not constructive. It will just result in a list of everyone's project, where no one answer can be "the answer". For more behind this check out the FAQ.
    – Walter
    Jun 1, 2012 at 12:11

8 Answers 8


I would recommend any of Google's open source C++ code, such as the following:

Advantages of using Google code:

  • It's written to high standards and is peer reviewed (unlike some open source code).
  • It has good developer documentation (which makes it easier to pick up and understand).
  • It uses some moderately advanced C++ techniques (and thus is good for learning).
  • It's probably easier to understand than Boost because it doesn't rely so much on advanced template metaprogramming and preprocessor metaprogramming and isn't weighed down as much with countless compiler compatibility hacks and special cases.

The Google C++ Style Guide that Google's C++ code uses is generally good, but it does have some fairly unusual bits (such as some of their naming guidelines or their disallowing exceptions), so keep in mind that their C++ code will differ in those respects from what you'll see in the field.


I wouldn't recommend reading a code base. I'd recommend reading C++ FAQS. There's also an excellent book that goes along with the site. Best way to improve your C++ coding skills.

  • 13
    -1: I very strongly disagree. Reading other peoples code is very important part of improving one's coding skills. Fixing bugs in that code is even better, though.
    – Jan Hudec
    Jun 8, 2012 at 7:49
  • 6
    @Jan Complete agreement from me. However, most C++ source code sucks and employs all kinds of bad patterns that would teach bad techniques. Do you know of a good OSS project which may serve as an introductory reading? Jun 8, 2012 at 8:48
  • I was referring to this one: amazon.com/FAQs-2nd-Marshall-P-Cline/dp/0201309831/… but I can see there are other books as well now. Jul 25, 2017 at 12:15

Reading existing clean C++ code is a great way to learn the language.

The code in the OpenFST toolkit is very clean, for example. It is readable and uses slightly advanced features without going overboard.

Boost, on the other hand, can be a bit hard to read, partly because they use C++ tricks that are hard to understand and because they often sprinkle the code with different workarounds for different compiler versions.


I would suggest reading the "Effective C++" by Scott Meyers and using the suggestions he has in little toy programs.

  • 2
    You won't learn anything on little toy programs. You need to write programs that solve actual problems. They don't have to be large, you won't manage to write large programs alone, but they must not be just toys.
    – Jan Hudec
    Jun 8, 2012 at 9:02
  • @JanHudec: What you describe is what I call toy programmes: a piece of code that solves a single problem. So, for example a Runge-Kutta algorithm would be a "toy programme" whereas a full N-body simulation would not be. Jun 8, 2012 at 9:26
  • 2
    Those are both "toy programmes". Because the problems are contrived examples of a problem unless you are doing numerical simulations and most programmers don't. Actual problem is something you or somebody you know is going to actually use. It will probably have GUI or at least rather complex command-line parsing and manipulate files or connect to network and use some existing libraries and won't have any non-trivial algorithms, because 99% programs out there don't.
    – Jan Hudec
    Jun 8, 2012 at 9:56
  • 1
    @JanHudec are you saying that a person doesn't learn anything by working with small, constrained problems first? If programmers jump directly into large and complicated problems without learning at least some basic principles and some basic language idioms, this is how we end up with these huge "Big Ball of Mud" apps. Jun 8, 2012 at 14:30
  • 3
    I'm not sure if this answers the question, but every C++ programmer should read that book (and its sequels.) Aug 30, 2013 at 17:08

Try reading something that has been existing for years and is large in size. It will take a few months of time to start to understand the code and getting to do something in it.

Firefox, Thunderbird, OpenOffice.org, LibreOffice come to the mind. There should be many more similar ones too. These projects run on many operating systems and hardware platforms. Also, they have to score on readability. These could should you the techniques you look for.


Even better than reading the code would be to work with that code in form of fixing bugs and adding small improvements here and there. Pick some program, preferably one you have use for, sign up to the mailing list, start going through their bug tracker and try to diagnose some bugs. Ask on the mailing list if you find solution for something whether it's reasonable or when you get stuck. That will give you some specific goals when reading the code, force you to really understand and is what you'll be doing most of the time in any work.

You can perhaps look at some KDE application. Most are written in C++ and you can start with some smaller one first.


Yes, the code of Boost C++ Libraries is a great resource to learn from, if not one of the best on the Planet. However, for a novice, learning from Boost code may make learning curve very steep. If you really want to try reading Boost, start with some small and simple libraries like Boost.Array.

  • 2
    I think that'd be like suggesting a good way to learn to ski is buy hitting the double-black diamond slopes. Aug 30, 2013 at 17:09
  • @StevenBurnap please, read my answer once again and point out that ridiculous suggestion I made. Stop b*****iting, would you, and point out a better comprehensive library worth to read by beginners. You'll come to conclusion that best examples that fit beginners are from a book for beginners.
    – mloskot
    Aug 31, 2013 at 19:20

Try reading the C++ PDF. It's free, and I learned C++ from it, even though I had no other programming experience, and I'm only 14. Amazing.

  • 3
    Can you add a link to some resource related to this projects?
    – Giorgio
    Nov 12, 2012 at 20:26
  • 3
    What C++ PDF do you mean? Nov 12, 2012 at 21:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.