Tips for Continuing Rails Development from 3rd Party

Sometimes you are continuing the works of 3rd party that is not so good.
Here is how I manage to continue developing the old project.

0. Check the application, play around a little bit until you know the work flow of the project.
1. Check errors when migrating. Sometimes old migrations hadn't been done correctly. You might want to update the migrations, tidy them a little, and make sure there is no fatal bug that might lurk somewhere on the migrations.
2. Check the environment configuration, plugins, gems, stylesheets, javascripts, and other dependencies that might be missing, and update the applications when necessary.
3. Refactor the model. You can refactor the models, remove unused methods (be sure to grep them first), remove unused comments, and sort or group the methods. You can change the models so they use nested attributes, and so on.
4. Look at the controllers. Start from home, and follow the work flow. Usually that means start from registering an user. Look at the methods on the controllers, refactor the controllers when necessary, such as inefficient queries. Shorten them whenever possible and try to get used to the methods. Try to use dynamic finder, named scope, rails helper methods to make sure your application works efficiently. Also remember the general guideline, skinny controller, fat model.
5. When you investigate a method on a controllers, look at the views. This is the crucial part. Make sure you adjust the view according to the proper rails work flow, such as finding objects on controllers, not on the view. On this stage you might want to use plugins that help tidying your application such as bullet (detecting n+1 queries), rails_best_practices, request-log-analyzer.

I hope this post can help you when you are continuing 3rd party works.

0 comments:

Post a Comment