Libraries

Many programming languages have great support for loading and using code written by others within your own code. These are called libraries. They often make it easier to do something that's otherwise difficult or annoying to do on your own. They're also helpful for reading how other people program, as the source code for open source libraries is accessible to read.

Languages sometimes have their own names for libraries... Sometimes their called packaged or dependencies. Ruby calls them Gems. Rust calls them Crates. Node/NPM/Yarn calls them Packages. They're all generally referring to the same things—code written by others that you can use.

Maybe you find yourself repeating the same three lines of code over and over and you'd like to make it one. That's a great case for a small library! Or maybe you've written some code that's not specific to your project and could be used by others. That's a great case for a library too!

The projects that follow are ideas for projects you could write that others could use. Each language has a different way of sharing libraries with others, so you'll have to do some research into whatever language you're using.

Writing an open source library can be a lot of fun and quite rewarding. Instead of a graphical interface or a command line interface, you’re defining a programming interface (API) for others to use and integrate with.

You’ll want to have well thought out functions and sensible naming. And you’ll want to have thorough documentation to make it clear to use. But don't worry if there are issues as you're starting out, you'll get better the more you build libraries and APIs.

Whether or not you open source the code you write is up to you. Consider how finished your code is and if it's stable enough for others to use. Writing your own version of a popular library can be a great way to learn a language.

What writing libraries are great for:

  • Writing focused code that accomplishes one thing (or a few related things) really well
  • Learning API design and documentation
  • Writing well-tested code
  • Getting more familiar with open source