Things to do before using a 3rd party gem, module, package, plugin, extension or library
Published: 2024-03-29 22:22:34

The speaker discusses the critical considerations when selecting dependencies, focusing on Ruby gems and NPM modules. It highlights the importance of evaluating factors like download counts, recent activity, and the presence of similar dependencies within the project before incorporating new ones. Emphasizing the risks of relying on thinly wrapped functionalities and the potential for dependency redundancy, the speaker underscores the necessity of minimizing dependencies and managing them carefully to mitigate maintenance challenges and dependency conflicts.

### Summary

**Introduction to the Topic**: The speaker introduces the topic of discussion, which revolves around Ruby gems, NPM modules, libraries, and dependencies.
    
**Factors to Consider in Dependency Selection**:
    
- The importance of considering factors like download statistics, commit frequency, recent activity, and community engagement.
        
- Warning against using dependencies with low download counts or infrequent updates.
        
- Caution regarding thin wrappers and dependencies that don't add significant value beyond wrapping existing functionality.
        
- Emphasizing the importance of evaluating whether a dependency provides enough value to justify its use.
        
**Avoiding Redundant Dependencies**:
    
- Advising against introducing redundant dependencies into a project.
        
-   Highlighting the potential challenges of managing multiple dependencies that solve the same problem.
        
**Impact on Maintenance and Upgrades**:
    
-   Discussing the impact of dependency management on maintenance, upgrades, and package dependency issues.
        
-   Sharing personal experiences with managing dependencies in various frameworks, such as Flutter.
        
**Conclusion**:
    
-   Concluding remarks summarizing the importance of active, stable dependencies and minimizing redundancy.
        
### Podcast

Check out on [Spotify](https://open.spotify.com/episode/0PmvTZbODEOIkoqcw49Cz1?go=1&sp_cid=03ae2ae7-c61c-4a5f-931b-46bad2d36df1&utm_source=embed_player_p&utm_medium=desktop).

### Transcript

**0:01**

Hey there, I hope you're doing well. In this video, let's talk about Ruby gems, NPM modules, libraries, and dependencies in general. The other day, I noticed that one of my team members had started using an NPM module with a minimal number of downloads. Right?

**0:24**

So, I had a chat with my engineer, and we discussed what factors to consider when picking dependent modules, gems, and libraries. Because often, when there's a need for something, people go to npmjs.com or rubygems.org and choose the first or second result that seems to fit their needs.

**0:55**

However, there are many issues with this approach. Firstly, the search results aren't necessarily based on popularity or adoptability. Sometimes modules with only a few thousand downloads per week or no recent commits appear. For instance, the NPM module we encountered had only a handful of weekly downloads and no recent commits or comments for the past five years.

**2:09**

This lack of activity raises concerns about the module's reliability and support. While some stable libraries may not require frequent updates, it's essential to assess the combination of factors like download count, recent comments, pull requests, and commit frequency.

**3:35**

Additionally, some libraries are merely thin wrappers around existing functionality, adding little value. For example, there are Ruby gems that wrap JavaScript libraries like Bootstrap without providing significant enhancements. It's generally better to interact directly with underlying libraries instead of relying on wrappers that may not be actively maintained.

**4:53**

While using a convenient library might save time initially, it's crucial to evaluate whether it provides sufficient value and support. If an alternative module already exists in your application's repository, consider sticking with it unless there are compelling reasons to switch.

**5:51**

Replacing an existing dependency should be a separate effort from feature implementation to avoid disrupting the codebase. Having multiple libraries solving the same problem can lead to maintenance challenges and dependency conflicts, making updates and package management more difficult.

**7:03**

Regardless of the framework used, managing dependencies is crucial to prevent future issues and ensure smooth upgrades. While libraries are invaluable for avoiding reinventing the wheel, it's essential to minimize their use, avoid redundancy, and prioritize active and stable dependencies.

**8:10**

If you're looking for products that use reliable dependencies, consider checking out snowpal.com. Give our platform a try, and let us know how much time it saves you. We're confident it'll make a difference. Thanks for watching, and bye for now!