Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am a student and I like to develop applications at my own level. While building an application I am the only one in my team.

After analyzing the application I choose a library/api to use for the project. For example,these days I am working on a chat application based on XMPP protocol.For that I am using smack api.

These third party api's are usually not very well documented nor they have good tutorials before one can start working with the api. These are unlike java api and other popular api's which are very well documented and there are very good tutorials to polish the concepts before one can actually start writing the code for the application.

My point is, it takes me a lot of time to implement a simple concept when I am using api of the like of smack. For example it has been quite a time and I have been unable to make one user read another user's status ! There are still many problems.

What kind of approach should I follow so that I could maximize my output ? The point is even not maximizing the output but understanding that how the api works.

share|improve this question
I'm not sure I understand the source of your confusion. The page you linked has prominent links to both a tutorial-style documentation with several example snippets, as well as above-average javadocs. It took me around 10 seconds to find the example code needed to subscribe to another user's presence status, and I've never even heard of that API before. As far as documentation goes, you could do a lot worse. –  Karl Bielefeldt Aug 18 '13 at 16:35

2 Answers 2

  1. Contact the author.

    Sometimes, authors do have tutorials and examples, but they simply don't care publishing them, or don't have enough time to polish the examples enough.

  2. Read unit tests (if the library is open sourced).

    Unit tests give you precisely the examples of how to accomplish a given task. They may be too short for a complete example of something useful, but are still a good starting point.

  3. Analyze the library itself.

    If the library has a clean architecture, it wouldn't be difficult to figure out how to start. It will require more work to figure out how to do some precise tasks, but you'll still get a good overview. Building diagrams from code would simplify your life.

Finally, if the author don't bother to respond, that the library doesn't have any unit test and if the architecture is unclear, abandon. There is no point in using a library which is in a such bad shape: you'll do more harm to the project using a library like that than reinventing the wheel.

Most importantly, don't read the source code. The following quote wasn't written about the APIs, but still applies to them as well:

If you can’t figure out how to use a class based solely on its interface documentation, the right response is not to pull up the source code and look at the implementation. That’s good initiative but bad judgment. The right response is to contact the author of the class and say “I can’t figure out how to use this class.” The right response on the class-author’s part is not to answer your question face to face. The right response for the class author is to check out the class-interface file, modify the class-interface documentation, check the file back in, and then say “See if you can understand how it works now.”

Source: Steve McConnell (2004) Code complete, 2nd ed. Microsoft Press.

share|improve this answer
Libraries are like standards - there are many to choose from and life is to short to waste on the bad ones. –  Dan Pichelman Aug 18 '13 at 14:49
I understand the last argument, but I would definitely look into the code. –  Jean-Claude Arbaut Aug 19 '13 at 5:57
Unit or integration tests? Surely you want to test the end behaviour or the API - treating it like a black box –  Dave Hillier Aug 19 '13 at 6:19
@DaveHillier: hm, good point. I would say both. Integration tests would give an overall view, while unit tests would be more detailed but still useful. I talked about unit tests only in my answer since I've never seen integration or system tests in an open sourced API. –  MainMa Aug 19 '13 at 6:27

Logic says if its so hard for you to implement in the first case, it would be more difficult if you would need to make changes in it in future, or if you try to seek help from a friend/instructor ( because they would be in the same state as you are now ). I comply by what @MainMa suggests. More often than not , you can find alternatives.

regarding the smack issue, here is a similar post on the issue. See if it helps. http://stackoverflow.com/questions/10808956/xmpp-smack-client-not-receiving-chat-message

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.