Cockatoo Software

Rescuing Rails Apps

Published on 09 February, 2012 by Keith Pitty

Rails is a wonderful framework for developing web applications quickly. However, that does not guarantee a robust, easy to maintain application forever. Codebases decay over time without due care, affecting their reliability and making them more costly to adapt to new requirements. This article covers some of the things that can go wrong and what can be done to rescue a Rails application that has fallen into a state of disrepair.

What can go wrong?

Plenty of unanticipated things can go wrong with a Rails application. From a user point of view, examples include:

  • the system unexpectedly returns an error page after the user submits a form
  • the system does not work as expected by its owner, perhaps due to a misunderstanding between the owner and the developers
  • the system does not function in the way that the instructions to the user imply
  • in some cases, the system takes far to long to respond when the user clicks a link or button
  • pages are hard to read and use on mobile devices
  • pages simply don’t work on mobile devices (e.g. Adobe Flash is not supported on iPhones and iPads)
  • users want to use the system for something that wasn’t envisaged or included in the current version

Of course, end users are not the only users of Rails applications. Consider the developers who, when reading the code, may find:

  • unnecessarily complex logic
  • excessively long methods that make it difficult to understand the intent of the code at a glance
  • poorly factored code resulting from the practice of copying and pasting code
  • view templates littered with logic that should be in presenters or models
  • unnecessarily convoluted database access code
  • the absence of adequate automated tests
  • automated tests that take so long to run that developers are discouraged from running them
  • inadequate use of caching techniques
  • code that may have seemed very clever to the developer at the time he or she wrote it, but which is later very difficult to decipher

There are just a few examples.

What can be done?

Rescuing a Rails application which needs a bit of TLC could involve a number of activities. Some of these are self-evident but I’ll list them anyway:

  • collaborate with the client to capture details and priorities of application problems that have been reported by users
  • estimate effort required to fix problems
  • fix problems approved to be fixed by the client
  • automate tests
  • conduct an audit of the codebase to establish the major shortcomings
  • use code metrics tools to pinpoint code that is very complex and therefore difficult to maintain
  • where appropriate, improve the internal design
  • establish a Continuation Integration practice
  • identify uses cases for which response time is unacceptable and implement solutions using techniques such as caching
  • adapt that design of the application so that it is a pleasure to use on mobile devices
  • extend the application to deliver new features

From a technical point of view, there is much more depth that I could go into. I’ll leave that for another day. Meanwhile, a good reference is the Rails Rescue Handbook by Mike Gunderloy.

Our Approach

We recognise that every client is different as is every Rails application. Consequently, we take the time to tailor our approach to each individual client.

We appreciate that budgets vary as do the risk profiles of applications. From the outset, we will focus on discussing with you what you see as the major problems with your Rails application that needs to be rescued.

Once we have listened to you and undertaken our own analysis of the state of your Rails application, we will recommend a course of action including cost estimates. From there our focus will be to nurse your application back to good health, keeping you informed every step of the way.

Rescuing your Rails App

If you have a Rails application that needs rescuing and you like the sound of our approach, please get in touch with us today.

Keith Pitty is the owner of Cockatoo Software Pty Limited. He has over 30 years of professional software development experience and has a passion for providing software solutions that help people. Away from computers he loves sport, especially cricket, golf and Australian Rules football.