Wednesday 10 September 2014

Sandi Metz Rules For Ruby on Rails Development

Recently I came across a talk by Sandi Metz  on YouTube.  She specified 6 Rules for writing quality ROR code. She describes these rules as norms and constraints rather than laws. I personally found them as a good standard to improvise on my code writing,

Here are the rules:

1)  No more than 100 lines per class

2) No more than 5 lines per method

3) No more than passing 4 parameters to a method ( She specified that you cannot cheat with a hash. Each hash key counts as a parameter.)

4) One Controller action may pass only one instance variable to its corresponding view.

5) 2 class names per controller action: One business and one presenter

6) Break any of the above rules, provided you can convince you pair (another programmer working with you).

No comments:

Post a Comment