Rules for If Statements
elsif,else grouping is like a set of sentences. Put blank lines before and after.Rules for Loops
Tips for Debugging
Access Control
When designing a class interface, it’s important to consider just how much of your class you’ll be exposing to the outside world. Allow too much access into your class, and you risk increasing the coupling in your application—users of your class will be tempted to rely on details of your class’s implementation, rather than on its logical interface. The good news

www.it-ebooks.info
ACCESS CONTROL 62
is that the only easy way to change an object’s state in Ruby is by calling one of its methods. Control access to the methods, and you’ve controlled access to the object. A good rule of thumb is never to expose methods that could leave an object in an invalid state.
Should you use inheritance?
In general, try to avoid inheritance. Other mix methods: modules and mixins are preferable.