Docunext


Refactoring in Ruby

March 30th, 2010

One thing I love about Perl is the concept of TIMTOWTDI (there is more than one way to do it). This is true for most languages, but I think its extra cool that the Perl community celebrates the fact that Perl's flexibility can take that concept to another level.

Ruby is similar in the way that there are many ways of accomplishing a particular goal. However, I'm finding that its not only easier to do it with Ruby, but I'm also finding I learn more about programming and Ruby itself when I engage in that exercise with Ruby.

Well let me start over at the beginning. Why, if something has been achieved, would someone want to find another way to do it? There are many reasons, and for clarity, this process is often undertaken under the guise of refactoring.

When I develop software, I often find that I, from time to time, develop some code which might be useful for other software programs, too. However, before those other software programs can use this code, its design must be altered, often made more abstract, before it can be generally accessed. As such, I begin start refactoring the code, changing how it achieves what it does.

Sometimes during the process, I'll decide to try something new. This is where Ruby really impresses me! I'll find a few different options and after trying them out, I feel like I've discovered an entirely new paradigm.

So if you are new to Ruby, you might like to consider embracing the Perl TIMTOWTDI philosophy. I have, and its taught me much!

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022