views:

186

answers:

5

I've got an application which developed by employing TDD as methodology (not strictly but mostly).

Now I want to outsource some parts of the application because I don't have enough time to develop it. I'm planning use websites such as "Rent A Coder", "elancer" etc.

I don't want to give out my code to anyone else, so I'm planning to give them a "Class Design" and bunch of "Unit Tests" that the class need to pass.

After this point when I deliver the class I'll run it against my Unit Tester (with different values) and see if it can pass it. If it passes everyone will be happy, and I'll call this class from my application as planned and it'll work.

Do you think this is good idea? What sort of pitfalls might happen? And this sounds too good to me, if it's why other people are not doing this?

+2  A: 

It makes sense, assuming that you have planned for this to work within your application. You should code your parts of the application to a defined interface, provide them with the interface and an applicable tests that you want to be validated to consider the assembly pass.

I would be very careful and thorough in designing the unit tests, making sure to expose a large scenario of failure scenarios. Also, I don't know how important it is to you, but if you could also distribute Code Analysis / FXCop rule exceptions for a person to code against as an additional step to try and ensure they follow the practices you lay out.

joseph.ferris
FXCop sounds like a really good idea, after all I'm going to maintain the code. I can't find/hire them every time I need a change in the code. Thanks for the suggestions. And providing interface with some strict rules sounds great as well.
dr. evil
+1  A: 

This seems like a good plan to me, in fact, this seems like a great way to put TDD to use!

chills42
+4  A: 

Depends on how good and detailed your specs are (units tests + design). Getting those done right would be 75% of your battle won. It might work on a 'few classes piece' but won't scale I think to bigger problems.

Pitfalls: the cartoon about the swing. Make sure you communicate your designs effectively or your coders will build you an elephant with uneven legs when you want Shadowfax. Tell them what you want, trust them and collaborate to come up with a design. A list of use-cases or user stories might be a better bet.

the classic cartoon, and now in colour

Gishu
+1 for the swing - added a couple of links in case anyone didn't get the reference
Ken
:) I got the reference although it's the first time that I've seen black/white version of it. I hear you, however I think it's still possible. I'm planning to go with really small classes and if the requirements changes (and they will) I hope I can maintain the code without too much effort.
dr. evil
+2  A: 

You say you're outsourcing part of the application. I'm guessing that you don't mean some features but rather some subsystem.

In that case the "unit tests" you describe are really acceptance tests for the subsystem, right?

The distinction is that the unit tests are implementation aware while acceptance tests aren't.

I think trying to outsource with implementation aware unit tests is a poor idea. You don't have the opportunity for learning and evolving the design.

Outsourcing via acceptance tests seems a fine thing.

Jeffrey Fredrick
Right, My understanding of a "unit test" is a "unit test" so if a methods says "listen port and return a TCPListener" and if unit test proves that the class delivers what it says (Design by Contract style), that's enough for me. Outsourced tests not supposed be implementation aware...
dr. evil
I'll take care of implementation tests by myself by testing the relations between classes and the whole system where required.
dr. evil
So I'm not quite what I've explained is a really unit test or acceptance test, but I think we're on the same page.
dr. evil
+2  A: 

I think unit tests might be valuable as specifications, but not complete. You're still going to have to make sure they understand the business value they're trying to deliver, where it fits in the overall picture, etc.

Also, keep in mind that just because something passes test, that doesn't mean it's good - a bubble sort still gets your data sorted. You need to review the code coming back.

bradheintz
At the same time, a bubble sort "works", that is, and with the correct design, he can take a little time later to refactor the sort after having a fully functional system.
chills42