Code Quality

Summarized using AI

How to Find Valuable Gems

Nathan Bibler • April 23, 2012 • Austin, TX

In the video titled "How to Find Valuable Gems" by Nathan Bibler at Rails Conf 2012, the main focus is on guiding beginner developers on how to effectively search for and evaluate RubyGems, essential libraries for Ruby applications. The discussion highlights the approximately 38,000 gems available on RubyGems.org and the challenges in identifying the most suitable libraries for specific projects.

Key Points Discussed:

  • Finding Gems: The process of locating appropriate gems can seem daunting. Users often start by simply searching on RubyGems.org, which lacks effective categorization, making it hard for beginners to know which gem to use.
  • Community Resources: The speaker encourages leveraging community resources such as Ruby 5, Ruby Flow, and blog posts for helpful insights and recommendations about popular and new gems.
  • Evaluating Gems: A significant portion of the talk focuses on how to assess the value of a gem:
    • Documentation: A well-documented gem is likely to show that the maintainer cares about the user experience.
    • Source Code Access: Being able to view a gem's source code can provide insight into its quality and potential issues.
    • Dependencies: It's crucial to check what other libraries a gem depends on, as this impacts maintainability and potential conflicts in applications.
    • Issue Tracking: Assessing the handling of issues on platforms like GitHub helps gauge the active maintenance and responsiveness of the gem's maintainer.
    • Versioning: Understanding semantic versioning is vital. A proper versioning scheme can indicate how updates may affect applications using the gem.
  • Practical Examples: The talk references various gems such as Cucumber for testing and discusses the implications of using low-utility gems like those to retrieve a list of U.S. states, suggesting that sometimes it's more pragmatic to write simple functions than to incorporate external dependencies for trivial tasks.
  • Maintainers' Reputation: The maintainers' commitment to their project is highlighted, stressing that active project maintenance is a key factor in deciding whether to use a gem.

Conclusion:

Bibler wraps up by emphasizing the importance of a thoughtful evaluation process when it comes to selecting gems. He encourages viewers to leverage community insight and take the time to understand the gems they're considering for their projects, ultimately advocating for wise dependency management in software development.

How to Find Valuable Gems
Nathan Bibler • April 23, 2012 • Austin, TX

There's no need to reinvent the wheel. There are over 30,000 RubyGems available on just RubyGems.org, alone. But with so many out there, it must be impossible to find the right one, right? In this talk we'll learn about some resources which help you find the right gems, as well as how to intelligently decide if a library is right for your project.

Help us caption & translate this video!

http://amara.org/v/FGiq/

RailsConf 2012

00:00:24.750 Alright, so this is how to find valuable gems. I'm Nathan Bibler and I work for Tickle in Deluxe, one of our products, especially given a beginner track today.
00:00:33.699 This is a good school for training in browser basics, Ruby, JavaScript, and all that other stuff.
00:00:38.829 I also do something called Ruby 5, a podcast that I host twice a week with Greg Pollock and a handful of people.
00:00:45.489 Has anyone heard of Ruby 5 or Code School?
00:00:51.190 The reason I bring it up is that I would encourage you to subscribe, especially if you are interested.
00:00:57.039 There is a subscribe button available on iTunes and RSS, and I will circle back to why I think that's important.
00:01:07.310 This talk is tailored more towards an entry level audience, so I thought I would start by explaining what a gem is.
00:01:20.280 A brief overview: since we are all here, it’s great that someone else is writing code for you. This means you can focus on other things.
00:01:37.380 The main focus of this talk is really finding and evaluating gems. The finding part is somewhat simple, as long as you've recognized the shortcomings.
00:01:54.270 I want to focus more on how I evaluate gems, because I think that's interesting and can differ from person to person.
00:02:03.239 Finding gems is crucial to your projects, and you might notice that it's hosted on rubygems.org.
00:02:20.910 At last count, there were around 38,000 gems available, which means there's a high likelihood that you can find anything you need.
00:02:34.140 These gems are generally free and open source. I want to start with an example to highlight a potential issue in finding the right gem.
00:02:54.270 Let's assume everyone has some idea of acceptance testing in Rails. This aligns with testing frameworks like Cucumber.
00:03:10.000 If you were to do acceptance testing in Rails, you would generally run 'gem install cucumber.' If you don't like Cucumber, you could try a different gem.
00:03:22.660 However, the way gems are set up can create difficulties for beginners. Gem names are unique globally, making it hard for newcomers to know what gem they're looking for.
00:03:34.030 So, if you're looking for a gem for acceptance testing, someone might quickly shout 'Cucumber,' but that's not helpful if you’re not familiar with the options.
00:03:54.280 To begin addressing this challenge, the first thing I suggest is to look for news and resources from the community.
00:04:10.600 As mentioned earlier, Ruby 5 is a good resource. There are also resources like Ruby Flow, Ruby Reddit, and many others that can keep you updated about new gems.
00:04:21.280 Many of these sources attempt to stay current and often have archives, so you can go back and search the history.
00:04:38.600 However, this takes a lot of time, and as a beginner, you often don’t have the luxury to sift through all available content.
00:04:51.760 You may think, 'I need to do a search on RubyGems because that's the canonical source.' It may seem simple to search there since they do provide a search tool.
00:05:06.610 For example, if you search for 'authentication' while trying to develop a user system, you might see multiple results, but many could be outdated or useless.
00:05:19.240 For instance, one of the top results might reference a gem with a last commit two years ago, which raises questions about its viability.
00:05:31.720 This shows that searching RubyGems.org isn't necessarily useful, especially when the descriptions can be misleading and outdated.
00:05:44.300 You may also want to take your searches to Google. Look for blog posts, example code, and resources like Railscasts that provide insights.
00:06:00.180 When searching on Google, utilize the customization features on the left-hand sidebar to filter results by date, ensuring you’re looking at recent content.
00:06:14.389 Ultimately, this process can feel overwhelming when you don’t know what to look for, especially regarding testing gems.
00:06:32.890 There are resources out there, such as 'RubyGems,' which you can explore to find gems in a more organized manner.
00:06:46.180 One example of a curated resource is '3B Jewel Box,' created by Christophe Ballest.
00:07:01.820 This resource categorizes many of the most commonly used gems, and it's especially helpful for beginners in Ruby.
00:07:25.720 From there, let's look at what I do to evaluate gems before integrating them into my applications.
00:07:37.340 The first thing I consider is how critical the gem will be to my application. If it's something that my app can't function without, I will be extra critical.
00:07:58.470 Conversely, if it provides some convenience, I might be willing to be less stringent.
00:08:10.900 Once I have determined the gem's importance, I like to examine the documentation.
00:08:30.130 Good documentation indicates that the author has taken the user's experience into consideration and is thus more likely to provide a smoother integration.
00:08:46.190 After checking documentation, I then like to look at the source code if it's available. Accessing the source can provide insights into the gem's quality.
00:09:02.740 Understanding the code can help determine if it is clear, maintainable, and well-structured.
00:09:17.930 It’s also crucial to examine the dependencies required by the gem, as they can add complexity to your project.
00:09:29.740 When you load a gem, you are essentially marrying the entire family of dependencies.
00:09:43.250 To illustrate, let's say you find a gem that has multiple dependencies. You would want to check each one and consider its implications for your project.
00:09:58.440 Initially, you can review these dependencies on RubyGems, which provides links to the source and home page of the gem.
00:10:09.950 When reviewing these dependencies, it’s beneficial to take note of the most important libraries that are involved.
00:10:27.480 It's advisable to check for any open issues in the project's repository, as a significant number of unresolved issues may be a red flag.
00:10:46.470 It’s important to gauge how responsive and active the maintainers are regarding addressing any problems.
00:11:01.680 Furthermore, observing the number of watchers and forks on the project can provide insights into its reception and desirability within the community.
00:11:13.960 If there are many watchers but a high number of open issues, that may indicate a lack of active maintenance.
00:11:30.860 In this case, you may want to consider looking for alternatives or ensure that proper documentation exists.
00:11:46.570 Next, I also keep an eye on versioning practices. Semantic versioning is a popular methodology that guides how library authors should manage version numbers.
00:12:05.340 Knowing how to lock versions in your environment is key to avoiding unexpected breaking changes.
00:12:23.780 Semantic versioning provides a structured way to signify major, minor, and patch releases, helping to manage dependencies effectively.
00:12:43.499 To conclude, all of this comes down to curation. The ultimate question is: do you feel the maintainer cares about you?
00:13:06.680 From processing the available information about the gem, you should be able to ascertain their level of commitment.
00:13:21.060 I invite you to think critically about the gems you encounter, and don't hesitate to speak up if you have any questions.
00:13:40.239 Thank you for your attention. Are there any questions?
00:13:49.400 You mentioned a few favorite gems; I'd like to discuss criteria on choosing and evaluating them.
00:14:05.130 My approach is generally based on the complexity of the gem's task compared to how quickly or easily I could implement it myself.
00:14:19.649 For something trivial, I might bypass using a gem and do it manually if it's a two-minute job.
00:14:32.896 On the other hand, if a gem can save me several hours of work or automate a process, it's worth considering.
00:14:49.100 For libraries like Rails that are core to your application, understand their implications. You want to compare gems, and gauge their popularity.
00:15:03.740 Ultimately, you want to invest your time wisely. Always assess the contributions of the community, maintainer engagement, and the overall reliability of the gem.
00:15:23.020 The real practice is understanding the risk and reward of integrating external dependencies into your application.
00:15:37.620 It's essential to have a logical mindset while evaluating gems, to help you make informed decisions.
00:15:49.530 As you continue to develop your skills, keep a lookout for reliable sources of information and actively participating within the community.
00:16:02.770 Over time, you'll build up a strong portfolio of your preferred gems that you trust and know work well for your projects.
00:16:14.860 Many developers in the community rely on recommendations and reviews, so be sure to share your experiences with others.
00:16:32.690 In summary, depending on the size and nature of your project, the gems you choose can significantly impact your development process.
00:16:49.540 With a thoughtful approach and a keen sense of evaluation of gems, you can leverage Ruby's vast libraries effectively.
00:17:04.380 Thank you for listening, and I'm happy to take any further questions.
00:17:17.050 I hope you gain new insights into finding valuable Ruby gems.
Explore all talks recorded at RailsConf 2012
+65