libraries

What's the right procedure to learn a new tool/library?


I'm a beginner-to-intermediate level programmer and a graduate student. I didn't get any chance for internships/jobs so far. Recently I've encountered lot of new libraries and tools with massive documentation. Some of them have books written about them while some have wiki pages written in poor English.

So far all I need to do is read the tutorials, copy-pasted the required parts, tweak around and put it in my project. The trouble is, I don't learn what exactly I'm doing. I just somehow set the things to work. Looking at API is always frightening.

What's your regular approach?

Do you read the complete docs and then get up to work? Do you 'learn' API formats? Do you look at the parts that may not be needed urgently? Do you memorize the classes, the modules and the functions? Has your approach changed over time?

I think I need guidance on this...


Solution

  • Not sure this question is appropriate here but here's my 2 cents:

    Learning APIs for a beginner is always somewhat tricky. You first need to "learn how to learn". The only way to do so is through practice. I think the best starting point is to learn language APIs, like STL for C++ or one of the many Java APIs (collections, regex, JDBC, executors, swing, etc.). Those usually have the best documentation and online examples and FAQ.

    I think it's important to learn what the API does first and then dig into how it does it. Learn little bits at a time: once you understand what you're doing you can add more classes/functions, but you don't need to learn them all, most of the times you will always end up using a subset of the API. There's no reason to memorize anything: that's why we have IDEs and online documentation, however you will end up memorizing the features you use the most just because of practice. Books are great. They usually give you a quick start and then gradually more details. For C++ I recommend "Accelerated C++", for Java the tutorials are pretty good and then you can look at books like "Concurrency in Practice" for more advanced APIs.

    Once you're familiar with core libraries, many 3rd party APIs will start to make more sense because often API patterns resemble each other. The easiest APIs to learn are usually the most popular ones because of the many resources available. For example, for C++ I recommend looking at the Boost collections and regex APIs, for Java you can look at the Apache commons and the Google Guava core libraries and then move on to log4j, JUnit, JDom, Jackson and even some of the Spring APIs (like JdbcTemplate if you use databases). Again, focus on the what first, read the tutorials and the books where available, come up with a simple project that uses some new API. Don't put them all together right away, but one at a time. You can integrate different API once you are familiar with them.

    Finally, when you are really familiar with learning APIs, sometimes it's interesting (and fun!) to look at the source code. Many Java IDE (like Eclipse or IntelliJ) will download source code for you and you will be able to browse API's code as if it was your own. That'll give you an insight in how "the magic" happens.

    I hope that helps!

    Happy APIs to you!