Mar 26, 2018

The purpose of this article is to remind you (and me) about what you need to consider if you want to create a library.

The “library” term here is not a place that has a lot of books in it, but a collection of functions, classes, or modules in a specific programming language or framework that purposes to help the programmer or developer to develop a software.

There are at least 5 points to watch out:

1. Start from a Specific Problem

When is the right moment I should create the library?

When the problem you wish to solve are common (eg. authentication, restful API, database, etc). And be specific, because for those common problems there are many libraries have been created to solve them.

In addition, when there is a source code that is used over and over again in many project. In other words, the higher level of reusability the more potential becomes a library.

2. Make It Easy to Install and Make It Simple to Use

Always remember that our main goal of creating a library is to make it easier for other developers to develop a software. Not the other way. If the library is created just to make other developers doing more effort to understand and use it, then the trash bin is the best place for your library.

3. Learn About the Design Pattern

Based on the meaning of the library previously described, libraries are used for specific programming languages or specific frameworks. Therefore, we must know the design pattern first, especially when the library wants to be created for a specific framework, because (in general) each framework has unique and idealistic design pattern. Although using the same programming language, the design pattern used in framework A is not necessarily the same as framework B.

Hint: The easiest way to learn design pattern is by looking the other source code of libraries that have been created for the framework.

4. Create an Example


5. Clear Documentation (or, at least)

At least your documentation of your library contains three things: