Why you should keep your gems up to date?

Keeping dependencies up to date not only fixes bugs or improves performance, there is more.

I have to confess that until last year I was not paying attention
to keep gems updated. My top 3 excuses:

  • “I have no time”
  • “I don’t want to introduce new bugs for free”
  • “It has not got new features that pay the bill”

Last year with Rails 5 release and Rails 3 out of support we had to update Playfulbet.com application from Rails 3.2 to Rails 4.2.

“I had to find time” because “It was going to pay the bill”.

After the experience I became fan of having dependencies updated as much as possible. I learnt some lessons.

The rest of the world does not care about the version you have in production.

That’s life. Open Source goes on.

You think that you will never have to update that small simple gem that just works. But, one day you’ll have to, you’ll have to upgrade Rails and that small gem will not be ready for this new Rails version. (True story)

Rails new releases force to update gems.

The sooner you update a gem, the sooner that new features are compliant.

You can use outdated gems for a long time. All this time you will incorporate code to your codebase that will rely on these outdated gems. You will develop tests as well and invest resources for testing and QA.

Is it not better to update gems as soon as possible so testing and QA investment lasts longer?

Know your enemies as soon as possible

When you try to update a gem as it is released and it breaks your application feel fortunate. It is not nice, I agree, but it is good, you found it on time, you did a good job. You know that you have a pending battle here.

What else can you do?

  • Create an issue in your issue tracker to plan the battle properly.
  • Write a small comment in the Gemfile file explaining why this gem is locked in this version and what breaks.

Don’t be afraid

Most of the times, updating a gem is not a pain. It is just a patch or a minor version and this is normally straightforward.

Even in the worst case, if updating a gem becomes a problem, isn’t better to know it as soon as possible? Update early, update often.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.