Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Rails apps maintenance
5 Posts
Rails apps maintenance

Previous answers to this question seemed to come from the point of view of the original developer. To me, though, the question seems to come from the point of view of a beginner taking over an existing application and that's who my answer is for: As previous answers have clearly implied, you should start with the tests. If the previous programmer was very good, reading the tests, running them and seeing how small (non-permanent) changes to the application might affect them will teach you a lot about how the code is structured.

On the other hand, if the previous programmer was a little sloppy about testing or simply not very skillful, adding to the tests will help you gain an understanding of how the application works and find problems that need to be improved.

Work on very small sections of the code at a time. Don't try to trace the entire site at once. Pick one model, see how it is used. If there are methods that are not tested, test them. If there are tests that don't work, fix them. When you understand one model, move to another. When you're done with all the models do one controller at a time and so on.

Also, run rake:doc and look at the documentation generated. If it's good, it will complement the tests. If it's not so good, improve it.

These are learning steps that will not stick in your head will if you do not actually work with the code. Add one small feature, writing tests first. Maybe add a new view of existing data, or a calculated result. Just something to allow you to work with it and follow the logic. Changes you make this way do not need to be permanent. You can create a "learning" branch where you can play to your heart's content without changing the production code. If the app is not under version control already, fix that as your very first step!

Above all, try to tackle the code in an organized way. The MVC organization of Rails lends itself to this. Use that to your advantage.

Good luck!

Sign In To Rate Post

Using tests is a great way to allow a less experienced person to try making changes to the code base. But really the only way they (or anyone) can confidently change code is to understand the app as a whole.

I've found the rdoc generator (rake doc:app) to be really useful. Even if you don't add your own doc comments, the automatically generated list of classes and their methods is a great way for someone to get a good overview of what things different classes can do (more important in custom lib includes and models than elsewhere obviously). But adding your own doc comments is very easy, and makes understanding the app (both how it works, and why it works that way) much easier for someone new to the project.

Also, don't be worried about someone being a beginner. If they're good, then they're good, beginner or not :)

In addition to good testing coverage, we have found two things to be very helpful - and both are not specific to rails but to development in general.

  1. Make use of code hiding - hide code in well named functions name your functions explicitly so you can tell exactly what they do. don't leave anything to guess...the book Code Complete has great information for that. name variables and methods in ways that describe them, not with arbitrary names....little things, take a tiny bit of extra effort, but make huge difference...

  2. Comment the code well. if you can promote design through pseudocoding (or whatever acronym you prefer) where a developer starts by commenting out what he needs to build, then filling in the code, it makes for more readable code that anyone can jump into...again Code Complete is great resource for sound practices....

Interested in any feedback on the above...

Use behavior driven development using RSPEC/Cucumber while developing the application. This kinda documents the requirements & validations of the application. When someone new takes over after a period of time, they can make sure that their changes don't break the regression scripts unless there is a change in user requirement.

Once an expert finished his task in developing a rails app. Whats are the best ways to another developer to maintain the same and add additional functionality especially if its a beginner(who maintains it).

As rails is young, organizations may find it difficult to recruit a expert for just the maintenance purpose.

or I can say, an expert may not be willing to stay there for just maintenance.

so, what would be the best ways for a beginner to maintain an expert developed application.

5 Posts
Login to add your message