views:

292

answers:

9

Hi there

I'm a student and I have a lot of free time on this vacation so I decided to put some time in learn more about how to write good code.(All I know at this moment is C and some C++)

My question is about how to find some applications source code? Let's say I'm looking for some source codes which are using a specific library. How can I find the open source projects which are using the library about I'm interested.

I've tried on google code and sourceforge but without success. I think i don't know how to search. Do you have any advice/link about how to do that?

+1  A: 

If there are specific methods that you know are included in the library, then you can always search for those.

Alternatively, if the library has an irc channel or a newsgroup set up, then ask the question on there.

Mr. Matt
+3  A: 

http://www.google.com/codesearch is your friend.

wm_eddie
quote:"I've tried on google code and sourceforge but without success. I think i don't know how to search. Do you have any advice/link about how to do that?"
Pod
A: 

Have a look at "The Dragon Book" if you can find it. Spinelli's Code Reading is also good. Both will help you understand the code you're reading.

Harald Hansen
+6  A: 

There isn't a one-stop-shop for finding open source code.

If you want to read some well written code, GNU's Savannah is a browsable repository of the GNU stuff (Binutils, GCC toolchain and tons of others). The GNU software, IMHO is some of the best written C anywhere.

You could also checkout MINIX which is an open-source microkernel based operating system (which is POSIX compliant too).

The Gnome project has many projects that cover a wide range of languages from C to Python and even C# (FSpot).

When searching for a project, if you know the name, google should help. If not, search for the library on google such as "libfoo", or look in the metadata of the package manager you use (it often has the upstream maintainer's website).

For example:

[aiden@devbox ~]$ ldd /bin/ls
    ...
    libcap.so.2 => /lib64/libcap.so.2 
    libacl.so.1 => /lib64/libacl.so.1 
    libc.so.6 => /lib64/libc.so.6 
    libpthread.so.0 => /lib64/libpthread.so.0 
    ...

I could google "libpthread" to find that it is part of the GNU C Library

If you want to get involved in FOSS/C then learn to use source control systems like Git or subversion, and diff for making patches. Talk to people, they always want fresh developers to triage bugs and fix problems. But you will probably find a pecking order and a social ladder to climb.

Good luck and have fun!

Aiden Bell
A: 

Koders may be helpful. It is a search-engine for source-code.

Mnementh
+1  A: 

There is a one-stop-shop for finding open source code.

It's called google codesearch and searches in lots of open source projects. To find code using a specific library, just search for the term you use to include it in code, for example #include <libusb.h> or import ipaddr.

phihag
A: 

Four "easy" steps:

  1. Select a free application you enjoy using
  2. Think about a feature it lacks
  3. Try to discover how to implement this feature
  4. Do it

Point 1 and 2 will retain you doing things.

With point 3 you will learn how to download sources, read patches and understand the code of different people.

And with point 4 you will practise coding and, if you like, you can start to officially collaborate with the project :)

Jaime Soriano
A: 

Visit Launchpad.net and get in touch with the friendly Ubuntu Community. This is a good place to start cause they are not that harsh if you ask a question.

bastianneu
A: 

Scott Hanselman has a series on his blog called The Weekly Source Code which is worth checking out.

Jason Sundram