Question

Would Reek be useful in training a ruby noob in good practices or does it require an experienced ruby eye to use and interpret?

I have mumble-muble years or programing experience but mostly in C variants. I've used Ruby lightly for the last few years as a utility scripting language but my ruby code is obviously largely just transliterated C. Now I wish to use it as a serious tool and I want to learn the "ruby way."

I've planned to use TDD/BDD from the start to provide the necessary training feedback and it looks like perhaps Reek might be useful in providing feedback about non-standard forms and uses. However, by long experience, I know that such tools can be two-edged swords that require prior experience to use and in hands of novice cause more problems than they solve.

Does anyone have experience in using reek (or a similar tool) in this way?

If it matters, I will be focusing initially on writing stand-alone applications for MacOS X i.e. no rails, server-stuff, etc.

Was it helpful?

Solution

No, Reek is not intended to be a Ruby style checker. If you want such a thing, I'd suggest Roodi -- or, better yet, pairing with someone who can show you good Ruby style.

I wrote Reek as a little research project, and frankly it isn't as useful as simpler tools such as flay, flog and rcov. Learn to be a better coder by eliminating duplication and complexity, and by TDDing your code.

OTHER TIPS

Reek warns about possible design issues (and some more trivial things), but it does not help you write idiomatic Ruby. Frankly, I think reading the features is just as valuable as actually running reek.

My advice for someone coming from C-like languages: get the for-loop out of your system. Pretend it does not exist. That will force you into more rubyish idiom.

Have a look at RuboCop

It detects many small things, and can even auto-correct some of them. If you use Git, you can stash your changes before you run RuboCop, so you can see the corrections using git diff.

I had to work to force myself into the TDD mindset and I am finding the toolkit provided by the metrical gem (a wrapper for metric_fu) pretty helpful. In fact I'd recommend going through all of the Railscasts on testing - it's not a huge time sink and I found it valuable.

The recent Railscast on how he does testing is a great way to set things up, then I went back and went through the other tutorials on Request Specs, Capybara, Metrical etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top