What Are Libraries and What Do I Do With Them?

Daniel Fenjves
upperlinecode
Published in
3 min readAug 1, 2016

Libraries. They’re those big buildings or classrooms you go to do research, maybe take out a book, and otherwise sit quietly and read, right?

Not a computer library. Source: CNN

Well, not for computers.

If you think about it, a library is essentially the collection of particular information in a particular way. In the physical world, that can look like a building that uses the Dewey Decimal System, or it can look like a bookshelf in your room that you organize by color or alphabetically by last name. In the digital world, a library is a package of information, in which the data inside is compiled specifically to run programs and develop software. Based on what’s inside and how it’s organized, you want certain libraries for certain purposes. So, much like you probably wouldn’t go to a children’s library for a scientific research paper, you wouldn’t use a C++ library to build a program in Ruby.

Computer libraries are files that hold code. That code can look like lots of different things: configuration data, documentation, help data, message templates, subroutines, classes, values or type specifications. The library itself is written in a computer language that then tells a program how to implement the contained resources into consistent, replicable functions. Every time any program calls on a library, the information or function inside is carried out the same way.

Libraries are extremely useful. Finding the right library means that instead of having to code everything from scratch, or even manually copying and pasting subroutines, you can just install the library and go. Multiple programs can call on a library at any time, which means their utility compounds and is far-reaching: users anywhere rely on programs which in turn rely on libraries. In this way, libraries are modular. You can plug-and-play various components that can help you gain functionality towards your program’s overall objective.

If this sounds a little abstract to you, try this: imagine if someone asked you to make a sandwich. You’d probably want to know what kind of sandwich to make. If the request was for a peanut butter and jelly sandwich, you wouldn’t start by looking for, say, ham and cheese. But you also wouldn’t start by looking for raw ingredients like peanuts, strawberries, flour, and eggs. Most likely you already have jars of peanut butter and jelly, and a loaf of bread lying around. You can assemble those pre-made ingredients and produce a sandwich much faster than if you tried make each component from scratch. When programming, libraries are like your loaves of bread and jars of peanut butter and jelly.

Libraries everywhere. Source: XKCD

Most languages come with standard libraries (or packages, if you’re using java), and you might hear them described as static or dynamic. Static libraries don’t get updated, and dynamic ones do. Depending on your language, you may need to implement libraries differently when compiling your program. As you start out in your programming career, you’ll mostly be learning how to find and use libraries correctly, and it’s unlikely you’ll need to fix bugs or modify any libraries you’ll be using.

At Upperline, we’ll be using libraries mainly in the context of APIs (or an Application Programming Interface). APIs are the backbone of much of web and application development, and they frequently come in the form of a library. APIs, like libraries in general, help you piggy-back on pre-existing code so you can make use of other programs and applications in new ways. APIs let you plug into apps like Google Maps or Facebook without having to build either of those yourself.

Once you become familiar with using libraries, the potential scope of your programs can become exponentially wider. For more on understanding libraries and APIs, check out some posts on Quora, and join us this summer for more hands-on web development.

--

--

Daniel Fenjves
upperlinecode

Code. Education. Teacher Training. Technology. Cheese.