Thread: Learning to use a new Library

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    2

    Learning to use a new Library

    Hi there! This is my first post on these forums. I know many of the basics of programming in c++, I would like to take the leap into taking an open source library and modifying it to suit my needs. Since I don't really have a lot of experience familiarizing myself with a bunch of libraries, this will be a real challenge!

    The library in question is OpenFOAM, in case you're curious. It is open source, however, the documentation for how to use the library is really quite poor... So far, I've been successful in executing several of the examples, and they do what the documentation says they should do.

    My question to you is, what steps do you take when you are learning how to use a brand new (poorly documented) programming library?

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    Welcome!

    It's not entirely clear from your post whether you want to modify the library itself (and possibly contribute back) or just learn enough about it to be able to use it. I think the latter?

    I'd do what you're doing -- build and run examples, read tutorials, at least for a little while. I find the best way of learning is just to get stuck in with a project. Preferably not too silly an invented one: but something you'd actually like to do. Do some tutorials that cover the sort of areas you'll need to know about. Give yourself enough grounding to know the right things to Google when the time comes.

    Open source stuff often has quite a bit of supporting content on the 'net, in addition to the official documentation. You could try hunting around for information from the community.

    I'm a big fan of running working examples in a debugger and stepping through it to get an idea of the structure of the program/library. Doesn't work well for everything, but good sometimes.

    Most importantly: don't despair! Every time I work on a new code base, or have to get up to speed on a library, I go through a while of thinking "I will *never* understand and be familiar with this". You just have to stick at it and trust that time will eventually meld library interfaces into your brain.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Gee, there seems to extensive documentation, as well as a note within:

    OpenFOAM is open source. The source code of OpenFOAM is a vital source of documentation in itself. As well as the actual code itself, most applications, for example, contain descriptions of what they do, there are descriptions of various models with supporting references, etc..

    The use of most applications can be learnt by looking at the corresponding example case in the $FOAM_TUTORIALS directory in the OpenFOAM release. The Allrun scripts show how many applications are executed.
    If you think this is poorly documented, you've not been around Open Source for very long.

    As far as how I would go about learning the library in an attempt to modify it? Stepping into the code in a debugger.

  4. #4
    Registered User
    Join Date
    Dec 2011
    Posts
    2
    Thanks smokeyangel and rags_to_riches! I'd actually like to learn the coding structure of the library itself well enough that I can modify the library, and "cannibalize" it in ways that would improve it. And if the application that I build is fit for public consumption, sure I'll contribute back.

    Keep hashing it out with the library? Ok. Run gdb? I'll try it. Thanks for the advice.

    If you think this is poorly documented, you've not been around Open Source for very long.
    True statement.
    Last edited by TuringsStudent; 12-30-2011 at 04:29 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static library vs Dynamic library
    By Alegomaster in forum C Programming
    Replies: 5
    Last Post: 03-17-2011, 07:26 PM
  2. Learning C++
    By darren78 in forum C++ Programming
    Replies: 8
    Last Post: 07-04-2010, 05:45 PM
  3. Replies: 19
    Last Post: 01-12-2006, 11:04 AM
  4. Learning Dos and learning Windows
    By blankstare77 in forum C++ Programming
    Replies: 8
    Last Post: 07-31-2005, 03:48 PM