How to learn quickly to use a library
Wed 05 Sep 2018

Imagine that you want to investigate to use a ruby gem or a javascript library as fast as possible. How can we do that? 

We usually tend to think of things complicatedly. We exaggerate the problems. What we should do is we think like the creator. We should create at least one open source to know the exact details of steps. We can see that there are two parts of whatever library:

  1. The configuration: More options, flexible usage - very important:
    • Locating the config file.
    • Reading the options to understand the cases.
  2. The main source code: There is one or two classes will take care the usage.

For example, we want do use sidekiq gem (library). Firstly, we investigate the configuration here.

File configuration: config/sidekiq.yml


:concurrency: 5
  :concurrency: 10
  :concurrency: 20
  - critical
  - default
  - low

It's apparently easy. But we often make ourselves confused. Keep in mind that any library has its own configuration.

  • Trying to find out the main class.
  • Reading code to know the usage and the idea behind the scene.