Four rules for developers

… according to Sandi Metz, author of POODR. She mentioned these in a Ruby Rougues podcast and I thought they were interesting!

1. Classes can be no longer than one hundred lines of code.
2. Methods can be no longer than five lines of code.
3. Pass no more than four parameters into a method. Hash options are parameters, so no giant hashes!
4. Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object.

Following these rules definitely makes you think a lot more about clean code!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>