Making junk into treasure

At the Steel City Ruby 2014 conference, Franklin Weber gave a talk called Utils is a Junk Drawer.  It was great!

He pointed out that in despite of trying to adhere to the DRY principle, and liking sharing our code with others, many projects have a “junk drawer” where general utility code that is unrelated to the project’s own business logic goes.

Often, this same code gets copy-pasted between many projects, or multiple people spend time developing the same utilities separately.

For instance, here is some utility code from a personal project of mine:

    # in config/initializers/date_time_formats.rb
      :month => "%Y-%m";

On his advice, I made this into a small gem called year_month, and published it.  I used this tutorial on making your own gem. One great thing about this tutorial was that you create all the files by hand — no code generators — which makes it easier to understand the minimal necessary structure for gems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s