views:

112

answers:

5

When I am unsure about some thing for a project, I usually use a small separate project and make it my playground for things need to be tested. How do you do that ?

A: 

I do it the same way. A temporary project has some disadvantages... You have to setup a new project as soon as you want to test something else. Also I found playgrounds to be pretty good references. Often I remember that I tried something previously and then I can look into the old playground files and even change it to adapt to new requirements.

Yaba
+1  A: 

This depends on what I want to try out. For simple algorithmic stuff, I have a console application that consists of many classes, one for every thing I want to try out. This way I have everything inside a single project and can browse through the ideas and approaches I've tried out during the years. I use folders for new topics and postfix the classnames with an increasing index (or something similiar that makes it easy to see the difference in the implementations by just looking at the class name), when I try out different solutions for a problem.

The only maintenance I do on the classes is do to filter out the things that do not compile (anymore), but wrong approaches are only marked by extensive comments in the respective class files. For me this is also a good way to see how my skills improve over time... and it's quite funny to look at old code, too.

I have a similiar approach for GUI related things as well as ASP.net application, so that I have a total of three test projects, all organized the way described above.

Grimtron
A: 

I don't use a whole subproject as playground - I normally make a simple testcase and if it works as expected I merge the code into my project. During the time as programmer there are lots of this textcases and I always keep them. It's good to have this examples - so whenever I am thinking about something I always have a look at my testcases first.

unexist
A: 

Sometimes I use a simple console app to test things out.

Other times, I clone (or branch) the main project and try things out in the copy. Often times, the clone gets copied back over (or merged into) the original once I've finished trying things out.

Still other times, I make sure the main project is checked in to source control, and then try things out there. If I don't like how things are working out, I roll back the changes.

Kramii
+1  A: 

I use 'spike tests' idea I first seen in 'TDD adventures in C#' by Ron Jeffries. Spike tests are coded as unit test classes, with chunks of code you want to try out instead of test methods. This way, you can easily try out some code you're not comfortable with by running it in test runner.

I usually place spike tests in the same project with unit tests. Once in repository, spike test code can help other developers understand your decisions in production code.

Sergey Volegov