Day 14: Understanding Software Libraries

Using a library is by itself a privilege. These days we have libraries for pretty much every complex task in software development. However, each time we use another library it is also a new opportunity to improve your understanding of software.

Most developers will approach a library by trying to figure out as quickly as possible how it is used. Frequently, they will not even read the documentation, and jump directly to writing code that uses the library.

Everyone knows that time is important for developers, and it would be difficult to understand every detail of hundreds of libraries we are required to use daily. However, it is important to consider that learning the inner workings of a library can represent the difference between writing poor programs and really grasping what you’re doing.

Using Libraries Effectively

Don’t just try to use a library. Also try to know what it is doing internally if possible. There are several ways to learn what a library does:

Most libraries, even proprietary ones, will ship with source code. This is common because it may allow third parties to do their own customizations. In the worst case, every decent library will have some documentation of what it is supposed to do and how it does it. Spend some reading time and that may save you lots of hours in debugging and design-related issues.

If you have a problem that is not discussed in the documentation, just take a look at the code if possible. Sometimes it is simpler to answer a question by directly going to the code than by reading a large manual. Sometimes, finding the answer by reading the code is easier than you think.

If the library is open sourced, then reading the code may be your only option. Many open source projects don’t have enough resources to create professional documentation. You should be able to answer yourself a lot of questions by looking at how the software is written. Maybe you won’t understand the details, but at lest the high level workings of the library should be easy to pick.

It is a fact that most libraries these days are available from an open source repository, such as github or sf.net. If that is the case, an easy way to figure out what the software is doing is just to browse the repository.

Another reason to familiarize yourself with a library is that this can give you better ideas of how to apply it. For example, there might be use cases that are not explicit from the documentation but that could be nonetheless useful.

It is also possible that, after looking at how something is done, you decide just do it yourself instead of using a library. Libraries have to be general when solving problems, but that may be just slowing down your application for no reason. It is important to have the freedom to solve such issues when needed.

Conclusion

Avoid using a library blindly, without given it at least a few minutes to understand what is going inside it. There are several opportunities for learning when working with other people’s source code.

Eventually, this kind of practice can help you in other levels. For example, you can even become a contributor for an open source library of your liking after you get more familiar with its source code.

Similar Posts:

About the Author

Carlos Oliveira holds a PhD in Systems Engineering and Optimization from University of Florida.
He works as a software engineer, with more than 10 years of experience
in developing high performance, commercial and scientific applications in C++, Java, and Objective-C.
His most Recent Book is Practical C++ Financial Programming.