Spring Is Dead to Me

Box o’ Springs by GFPeck is licensed under CC BY-ND 2.0

Spring, as described in its README, is a Rails application preloader.

It speeds up development by keeping your application running in the background so you don't need to boot it every time you run a test, rake task or migration.

I want to focus on the first assertion in the description above…

It speeds up development

I should begin by saying that I love the idea of Spring. As a developer, any tool that could increase my productivity deserves my attention. In practice however, Spring has burned me more than its helped me.

For lack of a better explanation, Spring is too magical. Your workflow doesn't need to change at all. It runs completely transparently, which makes it difficult to remember that it is running. So when something breaks… it's difficult to remember that Spring might be the culprit.

At Collective Idea, we practice test-driven development so I won't deny that Spring has saved me thousands of seconds in application boot time when running the test suite. Unfortunately, all of those savings are lost as soon as a pair spends a half hour to diagnose some elusive configuration bug.

/khanify spring

In the past, I've chalked it up to inexperience with Spring and have convinced myself that the sun is shining on the other side of the learning curve.

But I'm done. I've wasted enough time trying to save time.

$ echo "--skip-spring" >> ~/.railsrc

</rant>

Photo of Steve Richert

Steve is a Senior Developer working with Ruby/Rails and JavaScript. He’s an active open source contributor and the lead developer for Interactor. Steve is also involved in documenting and improving Collective Idea’s software development practices.

Comments

  1. February 04, 2015 at 11:03 AM

    I think it is just a matter to get used that you have spring there. I don’t have the same feeling than you, I think it is what I had been waiting for a long time in Rails. But I won’t take your rant right away from you :)

  2. lemig@hotmail.com
    Miguel
    February 04, 2015 at 11:25 AM

    My main issue with Spring is its incompatibility with better errors.

  3. February 04, 2015 at 16:49 PM

    OP: Why not just get in the habit of doing bin/spring stop the first time you get an oddity.  Very much like we all got used to CTRL-Cing rails server when we tweaked something in the config directory.  No?

    Miguel - What incompatibility? 

  4. February 04, 2015 at 16:53 PM

    Philip, the difference in my mind is that it’s very clear that rails server is running. It’s not as clear or as easy to remember that Spring is running. I’d love to just get in the habit, but pragmatism wins out because it’s already hurt us more than we’ll ever make up in time savings (which actually doesn’t take much).

  5. janko.marohnic@gmail.com
    Janko Marohnić
    February 04, 2015 at 17:32 PM

    I completely agree with you, Steve. I also liked it a lot at the beginning, and it was really essential to my happy TDD workflow. I thought I don’t need to remember that it’s running, because it just “automatically restarts itself when it needs to”, but boy was I wrong. It sometimes doesn’t restart itself when it was supposed to, and sometimes my bugs were solved by restarting Spring. And it’s so fragile, I feel that every Rails upgrade breaks it.

    The absolute deal breaker for me is that, when an error happens during your application startup (e.g. in an initializer), Spring will swallow the actual error, and print its help page. So you have to explicitly run bundle exec rails s without Spring to find out the actual error.

    I’m thinking of switching to Zeus again. Since I run tests from my text editor anyways (Vim), the plugin automatically prepends “zeus” to my commands.

  6. kocur4d@gmail.com
    kocur4d
    February 05, 2015 at 8:52 AM

    I am not an expert, just a casual rails dev. I had many problems with spring mainly with initializers, app configuration etc. This problems might not necessary be related to spring but when I comment it out and rebundle and stop using spring most of them are gone…. In my case time spent to find out what is not working while using spring > then not using it at all. And as I said I don’t really understand how it works and what it does.  

  7. February 05, 2015 at 11:59 AM

    I only use Spring for test runs, generators, and rake tasks.  I always start up the rails server separately without using Spring.  And I never really have any issues with it, maybe give that a try?  Spring & Guard also work great together for that fast test feedback.

  8. February 05, 2015 at 21:58 PM

    Pretty sure you can setup Guard to watch the files/directories that require a spring restart and have it automatically do it for you.

    Same goes for bundling after edits to Gemfile, restarting Pow when config changes, running a LiveReload server that watches the right folders in your rails app, etc…

    Without Guard, spring, zeus, spork, etc.. are all sources of frustration when you forget about them.

    I encourage you to give Spring another try alongside Guard.

  9. alex@kakuweb.com
    Alex Dearden
    February 06, 2015 at 3:47 AM

    Spring crashed both my apps. It also wouldn’t play nice with Rubymine so I killed it too.

  10. February 06, 2015 at 4:50 AM

    I’ve been burnt by forgetting that spring runs in background a couple of times now but I’ve also noticed that each time it takes less time for me to figure out why something appears to be broken for no apparent reason.

  11. March 17, 2016 at 10:15 AM

    Heroku doesn’t recognize the ‘spring’ gem, even though it’s listed in the Gemfile.

  12. July 19, 2016 at 11:45 AM

    I’ve had pretty good luck with Spring and I like it quite a bit! However, I have had a few things that have given false positives because the environment hadn’t reloaded. I