It depends on what you are optimizing for…
Today I was writing this code:
public class FakeRandomValueGenerator : IRandomValueGenerator { private readonly int valueToReturn; public FakeRandomValueGenerator(int valueToReturn) { this.valueToReturn = valueToReturn; } public int Next(int min, int max) { return valueToReturn; } }
This caused some concern to my pair, who asked me why I was hand rolling a stub instead of using a mocking framework. My answer was simple.
It will take me less time to write the class than it would take me to bring up the Add Reference dialog.
Comments
Too true!
I typically schedule my reference adding around getting a cup of coffee.
How about....
public class RandNum
{
<int RandFunc { get; set; }
}
syntax may be horribly off :)
doesn't this mean we should ditch visual studio for something more lightweight and faster
unfortunately m$ always try to bundle everything into one product and try to generate everything on the fly
i still prefer not to use IDE
i prefer things like textmate, vim, etc
LOL. Awesome.
If only IRandomValueGenerator were a delegate instead of an interface:
int random = 6;
var c = new ClassThatNeedsRandomValues((min, max) => random);
You've become complete freak man!! This is good.
If this is the only stub you need, makes sense. Otherwise, not.
Add Reference dialog is so slow !!!! that I was thinking why don't put four options outside:
-Add Project Reference
-Add File Reference
-Add Gac Reference
-Add Com Reference
The last two are the slow ones.
¿thougs? HEY? Someone that want to put a LADY-BUG
R# is pretty good about adding new references for you without having to open the "Add Reference" dialog.
I always have two or three instances of visual studio running at the same time. If one is compiling, running tests, blocked for no reason or about to crash, I'm working with the other one on something else. In other words, I'm switching every few minutes. :-/
Yes, I'm also an impatient person.
I did the exact same thing (well it was a different interface) for the exact same reason a couple of days ago. To my dismay I had to do something else in another test a couple of minutes later that forced me to go and add the reference anyway.
Use it as a couple of minutes to chill out and find something interesting to listen to...
Or do what I did and rewrite everything so it builds in nant straight out of SVN with just the SDK on the box. There are SO many problems relying on Visual Studio for even basic tasks sometimes.
Comment preview