views:

176

answers:

4

I've become a bit of a TDD zealot lately. Explaining the concept isn't the hard part. Most people respect the purpose behind it. However, when I try to demonstrate the actual process behind the idea, the biggest complaint is:

"When I'm writing my initial tests, I hate how Visual Studio intellisense tries to guess what I'm doing. It's obviously going to be wrong because I haven't written the API yet. It takes me out of context when I have to fix all the things that Intellisense has guessed incorrectly."

which, unfortunately often comes out as:

"TDD (or Visual Studio) sucks"

It's never really bothered me before (I just delete the stuff it guesses wrong), but I see the problem. What has everyone else done to get around this issue? Obvious answers are:

  1. Turn off intellisense when writing tests, then turn it back on when writing the API.
  2. Write your tests in something like Notepad++, then copy into VS when you think you're happy
  3. Stop whining

P.S. I looked everywhere on SO (and elsewhere) for this question so feel free to flag as duplicate if I missed it... As if you needed my permission ;-)

Edit: And, yes, I have Resharper, it's awesome.

+4  A: 

Learn to ignore the Intellisense, and get ReSharper. Then write the code you want and let ReSharper create the shells into which you'll eventually author your implementation code.

lance
+2  A: 

Err... Correct me if I am wrong but I personally love intellisense on the fly code analysis. Especially in conjuction with Resharper it makes TDD a real fun process. You write a test with not yet defined classes and methods, then extremely fast generate stubs using Resharper, make it compile, then add functionality to the point when your test runs successfuly, then you refactor as needed and rinse and repeat.

Ray
+4  A: 

Learn to use the Esc key and start to think about what you are programming. Intellisense is a double edge sword in that it both speeds up your coding but it also causes people to stop thinking about what they are doing. TDD is all about thinking, not mindlessly allowing the IDE to do your work for you. When the little pop-up Intellisense box appears, just hit Esc and it goes away without filling anything in.

Also, get Resharper. This is absolutely mandatory for programming in Visual Studio, but doubly so for TDD.

(Btw, Visual Studio does suck).

Chris Johnston
I'm glad I'm not the only one who things that about Visual Studio. I'm a recent convert (or conscript) from doing Java development in Eclipse, JDeveloper, NetBeans and now doing C#. I opened Visual Studio for the first time to start writing code and immediately asked "Hey, where's all the standard IDE functionality??" I'm so glad I found ReSharper.
Ogre Psalm33
I'll admit, pretty much everything coming out of JetBrains is awesome. I'm using RubyMine and MindManager and a Java dev I'm working w/ uses IntelliJ Idea instead of Eclipse. Great stuff.
joshua.ewer
A: 

Turn Intellisense off temporarily.

From the menu it's: Tools..Options..Text Editor and then turn off "Auto List Members" and "Parameter Information".

RBarryYoung