views:

721

answers:

11

Duplicate of:


I am learning C++ as a first language. I feel like I am about to hit a ceiling on my learning (I am not learning through a class) if I don't start looking at actual code soon. Here are my two main questions:

  1. Where can I find source code
  2. What is a good litmus test on code's quality (<-- I've obviously never developed in a work environment)

I hope this is relevant to SO, but I can see the need to close this. Thanks for the help.


Related:

A: 

The net is chock-full of open-source C++ code. Why not pick a few such projects, and, even better, start helping out of them? No better way of learning than by doing!

Alex Martelli
Do you have any particular recommendations? I'm trying to learn C++ as well. And while I can easily find a myriad of open source projects on the web, it's hard for me to tell which are examples of "good" code. My instinct tells me something like Firefox or OO.org ought to have good code, but might there be smaller open source projects that are more suited to a novice?
Calvin
+3  A: 

I think your two best bets for finding C++ code are to go to the popuplar open source repositories.

These all have high quality C++ projects you can take a look at. I don't think there's a great metric for judging quality on a large scale. I would start with the more popular projects which may be more likely to have quality code.

JaredPar
The problem is that there is probably more bad code than good code on these sites. Take randomly a project on source will not help "Hooked"
Rexxar
@Rexxar, I did not say take a random project though. I said start with the more popular projects on the **assumption** they would have higher quality code.
JaredPar
@JaredPar Sorry I misread your answer.
Rexxar
@Rexxar no problem
JaredPar
A: 

I would recommend getting a good book, which will be packed full of source code examples!

C++ in a Nutshell

You can also search open source code at www.koders.com

JerSchneid
I have the books, but there's a problem with books - they teach you to solve specific problems - not how to solve problems.
Hooked
+6  A: 

I would recommend Boost. Using Boost will simplify your program design. Reading Boost source code can show you how to use C++ to solve some challenging problems in a concise way.

This add on library is itself written in C++, in a peer-reviewed fashion, and has a high standard of quality.

Mike Ottum
Using Boost is great, but I wouldn't recommend reading Boost source code to a C++ student; it relies too heavily on advanced techniques like template metaprogramming and gets too cluttered (by necessity) with various compiler workarounds.
Josh Kelley
+6  A: 

Google Code University lets you search through programming topics and resources from many of the world's computer science schools.

Google Code University

Cev
+1. Thank you, their powerpoints on algorithms look very good
Hooked
+1. Didn't know about that one, thanks.
Andrioid
A: 

C++ is a great language, but kind of heavy as a first language. Try python.

1) Where can I find source code

Reading code is harder than writing it. This is especially true of large, complex languages like C++. Without already knowing the intricacies of the language, you don't stand much chance of getting knowledge from the complex code others write in production. You're going to have to learn the very smallest parts first, on your own by writing it. As you learn c++, you will also learn programming.

2) What is a good litmus test on code's quality

There isn't one. That's not going to be an easy thing to learn, either. It comes from experience. But really, the way you know the good code from the bad, is that after you've had some time to familiarize yourself with the layout of a project, you can understand what any given piece does, after you look at it. Readable code has quality, whereas confusing code falls short.

Looking at other peoples code is a hard way to learn the basics. Find a tutorial on the net and get your feet wet that way. I'm sure there are many, fine printed books on the subject as well.

As you go, and get stuck or confused or lost, post questions here.

TokenMacGuy
I've already written several programs and algorithms..I don't find it overwhelming, it just requires more time. Besides, I can't be asked to start learning another language until I have a better understanding of this one.
Hooked
A: 

I think you got some good answers already, I would like to add this suggestions for picking a project from one of the open source project repositories: Pick a widely used but preferably smaller project that has been around for a while and targets a domain that you are specifically interested in. That way you will be able to get a better idea of production ready code and be able to learn something about that domain.

Chris
A: 

koders.com; sourceforge.net

Regards, Bill Drissel

A: 

The List:

Mark Essel
A: 

I found the source code and documentation of POCO are quite readable, and

  1. unlike some other open source projects that focus on handling one specific problem, say GUI or Logging, this library focuses on developing a complete application, thus covering a quite broad area(file system, text processing, networking, logging etc ).
  2. it uses modern C++ idioms. So by reading the implementation you can learn modern C++ skills as well.
t.g.
A: 

I would recommend OpenSG It is an interesting topic, it uses concurrency modeling, networking, includes links to scientific papers, is well documented, uses real c++ not c with objects stuff and almost all subparadigms and doesn't overuse them, is easily accessible AND who would have guessed... I am a fan of it ;)

OpenSG - Home

AndreasT