Rails Best Practices: introduction

I’ve decided to dedicate a series of posts to Rails Best Practices because I think it is important to share in order to continuously improve the way you write programs.

Write these posts will also be an opportunity for me to investigate my knowledge, so I invite you right now to follow this trip with me and contribute with your comments.

This first post is just an introduction in which I want to highlight the advantages of writing Ruby on Rails applications following the Best Practices rules. In the following posts of this series I will try to explain the basics concepts to write better and more manageable code through concrete examples.

But now I’ll summarize the main benefits from following best practices:

  • Readability: a code more readable and clear is especially useful in projects involving multiple developers but also on individual projects. Did you ever faced with some chunk of code you wrote a few months before? It was quite clear and readable?
  • Flexibility: well written code is generally more modular, hence easier to adapt to new requirements or to changes request by the client. But flexibility also makes it easier to reuse some features rather than a block of code already wrote in the past on new projects.
  • Maintainability: a modular and DRY code is easier to correct and easier to understand.
  • Testability: write code according to best practices makes it easier, as we shall see in the next post, the flow of operations performed in the controller. Thus, even test methods will be easier to write.

In the next post will begin to see how to move pieces of code from the controller to the Model, according to the practice in the world rails is called “Fat Model – Skinny Controller“.

The arguments of the later posts will be instead:

  • RESTful Conventions
  • Model Optimization
  • Model Break Up (Module, Composition, Observer..)
  • Best Practices on Migration
  • Use Filter within Contoller
  • View
  • Helper

Tags: , , ,


About Claudio

Claudio Marai is a co-founder of DevInterface.

After graduating in Computer Science has contributed to develop complex web applications based on Java/J2EE and desktop applications with the. NET framework for the Ministry of Justice and ultimately for the banking ambit.

The passion for web in recent years has led him to be interested in more modern frameworks such as Ruby on Rails and Django, and to a development approach based on agile methodologies such as eXtreme Programming and SCRUM.

About DevInterface

We are an information and communication technology agency. Our mission is to provide web application development, design services and communication strategies. We specialize in building web applications with modern and efficient frameworks.

Related Post

5 Responses to “Rails Best Practices: introduction”

  1. Rafael says:

    Excellent! I was waiting this kind of articles for a while. I’ll follow you nearly.

  2. Great blog post.Really looking forward to read more.

  3. Richard Huang says:

    Hey, you should add the reference to ihower’s presentation, http://www.slideshare.net/ihower/rails-best-practices, I think your posts are the same.

  4. Claudio says:

    Hi Richard, thank you for your contribute.
    I’ve read ihower’s presentation and yes, it has been one source of inspiration (not the only one) for this series of posts.
    But my intention is to write more detailed articles and stimulate a discussion on what are best practices to follow in Ruby on Rails.

  5. Nice background, your posts were very good to read and it was something related to me.

Leave a Reply

Insert code beetween <code lang="ruby"> and </code>

Copyright 2012 DevInterface s.n.c.

DevInterface Blog is proudly powered by WordPress