Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming Open Source

Ask Slashdot: Best Programs To Learn From? 329

First time accepted submitter camServo writes "I took C++ classes in college and I have played around with some scripting languages. We learned the basics of how to make C++ work with small programs, but when I see large open source projects, I never know where to even start to try and figure out how their code works. I'm wondering if any of you have suggestions for some nice open source projects to look at to get an idea for how programming works in the real world, so I can start giving back to the FOSS community." Where would you start?
This discussion has been archived. No new comments can be posted.

Ask Slashdot: Best Programs To Learn From?

Comments Filter:
  • The kernel (Score:0, Funny)

    by Anonymous Coward on Thursday September 08, 2011 @11:49AM (#37340872)

    Off you go

  • by Anonymous Coward on Thursday September 08, 2011 @11:53AM (#37340934)

    And then do the opposite.

    Works every time.

  • by ilsaloving ( 1534307 ) on Thursday September 08, 2011 @11:57AM (#37341004)

    If you want examples of 'real world' programming, take a bowl of spaghetti, add some additional ingredients that you wouldn't normally expect to see in spaghetti, and then fling the whole thing against a wall.

    That's what the vast majority of modern day code looks like, especially if the organization that wrote the code tried to outsource the development effort 'to save money' at some point during the dev cycle.

  • techniques (Score:5, Funny)

    by lkcl ( 517947 ) <lkcl@lkcl.net> on Thursday September 08, 2011 @01:16PM (#37342034) Homepage

    the most important thing is to have techniques that allow you to find your way. the language doesn't actually matter, but it does definitely definitely help if the code is documented in some fashion. i tried, for example, to work on fontforge with my usual techniques, and the code was so incredibly dense and uncommented that it was absolutely impossible to understand. but, exceptions aside, here's a starting point for getting into large projects:

    * use vi. do not use graphical editors. do not use emacs
    * get a damn big monitor (or 2 monitors). open xterms at 80x60, as many wide as you can get.
    * use a multi-window desktop manager (i use fvwm2 and i run a 6x4 grid: that's 24 desktops.
    * be prepared to open (and background) up to 200 simultaneous files, across multiple windows.
    * make sure that you open the files from the *root* of the project.
    * open the files "by name", explicitly, so that you can do "jobs | grep {filename}"
    * run "ctags -R" - it is your friend. then use ctrl-] on a function you don't know, and read about it.
    * remember to use :e # to go _back_ to the file you were originally editing (after using ctrl-])
    * be prepared to print out the ENTIRE codebase, and flip through it, off-line, very very quickly.
    * be prepared to do page-down, page-down, very very quickly, through as many files as you can stand

    the main thing to do is to get a vague map of the code into your subconscious, as quickly as possible. then you will go "i've seen that before..." and you stand a chance of being able to hunt for it and find it.

    you *don't* have to memorise the entire codebase - you *don't* have to even understand all of it. but you *do* need to at least have the techniques which will allow you to jump to wherever it is that you want to go.

    ultimately, though, you need a goal. what, exactly, is it that you want to achieve? if you have no goal, you are pissing in the wind.

    i added NT Domains Security to freedce - that's a good, simple goal. FreeDCE is 250,000 lines of code, and very well laid-out. it was therefore quite straightforward to add 6,000 lines of code to do NTLMSSP. took a couple of weeks.

    i added python bindings to webkit - that's a good simple goal (ok, it was horrendous, requiring over 12 different skillsets, including c, c++, python, perl, autoconf, gtk, python c modules, IDL files parsing - the list just went on and on). webkit is a massive project, and also very well laid-out and structured. the first version of the python bindings took about 8 weeks, and the 2nd (faster, better) version took only 2. the reason why the 2nd version took only 2 weeks is because i hunted down the mozilla xulrunner IDL file parser, hunted down python-gobject's code generator, adapted the xulrunner IDL file parser to understand the webkit IDL file-format (2 days), then spent the rest of the time hacking codegen.py to spew out the data types from webkit, and to create a standard python c module.

    so you say "you don't know how to get familiar with a free software project", well, i am not - i wasn't familiar with webkit, but that didn't stop me. i wasn't familiar with xulrunner, but that didn't stop me. i wasn't familiar with python-gobject's codegen, but that didn't stop me. i just got on with it, and just trusted that the surrounding code would do its job, and trusted that the bit of code that i picked up could be adapted.

    so in many ways, tackling a large codebase is more about overcoming your own fear and feelings of inadequacy. sometimes not even i can do that, and sometimes i can.

There are two ways to write error-free programs; only the third one works.

Working...