A Short Guide to Our Favorite Libraries of 2020

Tags

Laptop sitting on desk with Javascript language on screen.

As a final sendoff to the surreal and disconcerting year that was 2020, we decided to pivot away from the chaos and end this year on a positive note. And what better way to give us all something exciting to look forward to than by summarizing our favorite libraries? We asked the brilliant minds at DockYard to share some brief insights on their favorite tools for navigating complex projects. Here are some of their favorites:

Elixir

Nathan Long, Senior Software Engineer

Library name:
Bypass

Benefits:
Bypass makes it easy to test your code against custom, test-specific HTTP endpoints. What especially pleases me is that the endpoints are real Elixir processes listening on real TCP ports. This is a trick you can only pull off with a process model like the BEAM’s.

Library name:
Oban

Benefits:
Elixir developers don’t always need traditional “background jobs”; often, a supervised Task will do. But when we want those jobs to survive restarts and leave behind a record of their results, Oban is a great fit. It makes clever use of PostgreSQL to track jobs so that you don’t need another data store, and it supports recurring jobs with a cron-like syntax.

Library name:
Phoenix LiveView

Benefits:
LiveView lets developers quickly add interactive features without the overhead of coordinating an API with front-end code. Not only have I enjoyed using it, but I look back at applications I worked on before LiveView and see what a productivity boost it would have been.

Mike Binns, Senior Software Engineer

Library name:
Credo

Benefits:
One of the objections that Elixir faces in companies is the difficulty of finding Elixir Engineers due to their high demand. Given this, many companies have learned that it is worth the time to level up their existing engineers by training them in Elixir. This is where Credo shines. Credo is like having an Elixir mentor constantly looking at your code, giving you hints as to best practices, pitfalls to avoid, and insight into the language to help you better understand it.

Zach Liss, Software Engineer

Library name:
ExMachina

Benefits:
ExMachina is helpful for building a maintainable testing suite as an application grows. Instead of relying on fixture data in tests, which can lead to implicit state and hard to debug behavior, ExMachina leverages factories that allow each test to start with a blank slate before explicitly creating and inserting any data required for execution.

Javascript

John Leja, Senior Software Engineer

Library name:
ember-cli-code-coverage

Benefits:
When trying to decide on how many tests to write for a component, route, etc., it can sometimes be hard to judge when you have just enough coverage. Ember-cli-code-coverage is a wrapper library for Istanbul, which is a JS instrumentation library that will track statement, function, and branch coverage and display it in an easy-to-understand interface. Running the coverage report is a good practice from time to time to ensure that you have tests to cover any business-critical logic or functionality that could regress without notice.

Library name:
ember-lifeline

Benefits:
When I first started learning Ember, everyone always told me to never touch the run loop as it was super fragile. Maybe they were doing thing wrong. Ember-lifeline provides a functional API that allows you to associate async behavior to your class instances, and have them be automatically cleaned up for you once the class is destroyed. Lifeline provides replacements for common run loop and DOM event handlers (runTask, debounceTask, add/removeEventListener, etc.), but also allows you to associate your own functionality.

Miguel Camba, Senior Software Engineer

Library name:
ember-set-body-class

Benefits:
It’s very common to need to add or remove classes to the page’s body when something else happens: A class to prevent scroll when a modal opens, a class to change layout when a video player gets bigger… This addon exposes a single helper that makes this something you can do declaratively just from the templates, no need to reach for javascript classes or services for it.

Scott Newcomer, Software Engineer

Library name:
ember-in-viewport

Benefits:
DOM observability is often a critical performance technique that can improve end-user experience. Previous tactics to watch and take action when a DOM element came into viewport would occur on the main thread. This library not only takes observing DOM elements off the main thread. It also pools your observers, helping save memory when you put a particularly high load on the browser with many elements to observe.

Library name:
ember-changeset

Benefits:
When working with form data, it is sometimes important to provide both validation and constraints as a user progresses through your forms. For example, you do not want to sync local client state until a password field passes your particular constraints. This library works out of the box with ember-data as well as provides a lower level primitive for ecosystems outside of Ember.

Ruby

Kay Rhodes, Senior Software Engineer

Library name:
noisy_partials

Benefits:
It embeds HTML comments at the start and end of each partial. Makes it very easy to view source on a page and know which partial you need to go edit.

Drew Chandler, Senior Software Engineer

Library name:
rubocop-performance

Benefits:
This gem can help find code that could be written more efficiently by calling a different method. It is a great way to find some low-hanging fruit optimizations.

Dan Baugh, Senior Software Engineer

Library name:
pry-byebug

Benefits:
Pry-byebug adds step by step debugging and stack navigation to pry. It is extremely useful for following code paths and debugging issues, checking values along the way. It is one of the first gems I will usually add to a new project.

Library name:
bullet

Benefits:
ActiveRecord makes it easy at times to introduce N+1 queries into your application - this helps to resolve that issue by notifying you when you should add eager loading. It also notifies you if you are using eager loading that is not necessary, and overall helps reduce the number of queries your application makes - all leading to improvements in overall performance.

Christian Trosclair, Senior Software Engineer

Library name:
Map

Benefits:
The Map gem gives you a Map utility class that is string/symbol indifferent, dot access, a host of recursive capabilities, sensible option parsing, a ton of ways to build/instantiate them, and a whole lot more. I’ve used it a ton and I haven’t run into a gotcha yet, whereas in other, even more focused and more popular libs have edge cases that you stumble on at the wrong time.

Matthew Erhard, Senior Software Engineer

Library name:
graphiti

Benefits:
Graphiti is a gem that combines the benefits of both GraphQL and REST in one library using JSON: API spec and some conventions. It is Rails agnostic, fully-featured, and well supported.

Aimee Boustani, Software Engineer

Library name:
factory_bot_rails

Benefits:
Factory Bot provides a clean, straightforward syntax for creating test factories, as well as a simple way to create relationships between factories. The factory file itself is easy to update as the object models change, eliminating the need to edit more than once per change.

Looking Forward

As you set out on your next project, keep these tips in mind and take a lesson from the year 2020 and remember, there is always a solution, always a better way, and always a light at the end of the frustration.

2021 already has a nice ring to it, doesn’t it? Wishing you happy building and less breaking in the New Year. Cheers!

DockYard is a digital product consultancy specializing in user-centered web application design and development. Our collaborative team of product strategists help clients to better understand the people they serve. We use future-forward technology and design thinking to transform those insights into impactful, inclusive, and reliable web experiences. DockYard provides professional services in strategy, user experience, design, and full-stack engineering using Ember.js, React.js, Ruby, and Elixir. From ideation to delivery, we empower ambitious product teams to build for the future.