Ruby on Rails: Another 5 Not So Frequent Programmer Trapsby QArea Expert on June 13, 2014
In the previous article “Ruby on Rails: 5 Most Frequent Programmer Traps” we’ve discussed the most common mistakes developers are prone to while coding in “Rails”.
This time our Ruby on Rails outsourcing team has prepared another set of 5 traps, not so common but still dangerous, you should watch out for while building your products with Ruby on Rails.
Here are they.
- Log Files Ignored
While many apps use log monitoring tools such as New Relic and Honeybadger in production, it’s nevertheless important to have an eye on the log files during the developing and testing processes in order to timely get cues about any inefficiencies in the code and to have a chance to correct these before your product goes into production. If you neglect this practice, you’re likely to find about some resulting performance issue when the system’s already live.
- Few Automated Tests
Both Ruby and Rails offer powerful test automation capabilities by default. Despite add automated testing into a Rails application is easy, many projects out there still have very few tests written. Therefore, it’s recommended that each controller action has a high-level integration test.
- Calls To Third Party Services Blocked
External Rails service providers normally make integration of their services in your app very easy via gems wrapping their APIs. To avoid blocking of the calls to such services, move them to some queuing service for background job if possible. Try such popular Rails gems as Resque, Delayed job, and Sidekiq for this purpose.
- Too Much Affection For Existing Database Migrations
The database migration mechanism of Ruby on Rails gives you a great way of managing granular changes in your product’s database schema. At the beginning it always works perfect, but as time passes, the process of database creation can take much time and migrations often get misplaced and out of order. When this happens and running migrations takes too long, developers should have courage to clear out their old directory, dump the new schema and go on from that point.
- Sensitive Data Checked Into the Source Code Repository
The file containing a secret token used to secure a browser session often gets mistakenly checked into source code repositories along with the rest of the app which lets anyone who has the repository access easily compromise your app users. So make sure the file with the token is excluded from the repository configuration file.
Ruby on Rails makes a powerful framework which hides many tricky details necessary to develop a robust web product. While this ensures a fast web application development process, developers need to pay attention to certain potential coding and design pitfalls in order to make sure their apps are highly extensible and maintainable even as they grow.