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?
|
|
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. |
|||||||||
|
|
I would recommend any of Google's open source C++ code, such as the following: Advantages of using Google code:
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. |
||||
|
|
|
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. |
|||||||||||
|
|
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. |
|||
|
|
|
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. |
|||||||||
|