Guru on Rails

if you don’t sacrifice for your dream then your dream becomes your sacrifice.
Sydney, Sat 01 Jun 2019
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

Options

---
:concurrency: 5
staging:
  :concurrency: 10
production:
  :concurrency: 20
:queues:
  - 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.