Ruby Style Guides and Tools: How to Write Good Looking Ruby
Last week, Noel Rappin of Pathfinder Development wrote Elements of Ruby Style - an attempt at producing a Ruby "style guide." After some initial feedback to this, he's followed up with a response to some of the initial criticisms and suggestions.
Noel isn't the first to try to develop a Ruby style guide. In an attempt to promote Ruby's use within Google, Ian Macdonald wrote an extensive Ruby style guide back in 2006 (rather sadly, it appears his attempt did not work out).
What's a "Style Guide" then?
For those unfamiliar with style guides, the most famous for the English language are probably Strunk & White's The Elements of Style and The Chicago Manual of Style (my personal favorite) - both attempt to define how to write and lay out English texts properly. Style guides for programming languages, however, usually attempt to not only define the "correct" way to write and lay out code but also the right idioms to use in certain situations.
Ruby style and "code smells" have become topics of interest for many Ruby developers recently:
- Last month, Kevin Rutherford released reek, a "code smells detector"
- Marty Andrews released Roodi, a tool that checks Ruby code for complexity
- flog is also a popular Ruby tool for testing and showing the complexity of your Ruby code.