Sandi Metz's 5* Rules

Posted: December 13, 2013. Tags: Software Craftsmanship

Saw a very interesting presentation by Sandi Metz last night. The essence of it is captured in the 5 rules below:

  1. Classes can be no longer than 100 lines of code
  2. Methods can be no longer than five lines of code
  3. Pass no more than four parameters into a method
  4. Rails controller actions can only instantiate one object
  5. You can pass only one instance variable to a view

Kinda like CodeClimate on steroids. In fact if you comply with these 5 rules, I believe you have automatically created a 4.0 GPA app (with the possible exception of code duplication).

I added the asterisk because of the 6th rule, which is: You can break any of the 5 rules as long as you can convince your pair that it is a good idea.

Update 2014/1/2: It turns out this talk was recorded at the BaRoCo.