I. Don’t. Bargain.
— Marshall Sam Gerard, The Fugitive
I wrote yesterday about the warnings I’ve been getting from RubyMine, and my eliminating them.
RubyMine warns when it cannot find the definition of a method. I got many of these warnings for methods that are defined dynamically, at runtime, instead of statically.
At first I thought I might leave the code as-is, because if a method really is not defined, there will be a runtime error when it’s time to call it. But then I realized that there are two important consquences: RubyMine will not be able to perform either code completion or code navigation for an ‘unfound’ method.
This is important to me, because I want someone writing test code to get as much help as possible from the tools. If RubyMine can’t do code completion for a method, the programmer will have to know outright the name (and correct spelling) of the method he wants.
That will not do. So I’ve changed my code so that RubyMine now finds the definitions, and can do both code completion and code navigation.
After 90 days in my new project, it seems certain that we’re going to continue testing with Ruby, so I’ve bought an IDE, RubyMine. That gives me a debugger, which is often convenient and sometimes critical.
It also gives me static code analysis (RubyMine calls it code inspection), which is the equivalent of compiler warnings. Steve McConnell is very large with compiler warnings, as am I. In a few hour, I’ve reduced the number of warnings to zero, which is where I want it to remain. If there are a lot of unexamined warnings, something important may be hiding therein. (Actually, there was a warning about a case statement that had no else clause. I’m usually scrupulous about that, because is absence can cause downstream symptoms that are difficult to diagnose later on.)
Now my code is warning-free!