3

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.

TechZen
  • 64,370
  • 15
  • 118
  • 145
  • Since someone voted to close, let me clear what I am asking. I am asking about the functionality of reek and the type of feedback it produces. I don't view this as a subjective question. Either it provides useful feedback for novice users or it requires a more expert interpretation. – TechZen May 16 '11 at 02:58

4 Answers4

4

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.

kevinrutherford
  • 448
  • 3
  • 8
1

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.

Lukas Elmer
  • 195
  • 4
  • 7
1

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.

steenslag
  • 79,051
  • 16
  • 138
  • 171
  • You seem to be saying that Reek would help you spot design issues more or less generic to any language/environment but that it won't shape the way you use any particular language. – TechZen May 16 '11 at 01:28
0

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.

Richard Jordan
  • 8,066
  • 3
  • 39
  • 45