How to set a TDD coding challenge

18 views
Skip to first unread message

Rupert Wood

unread,
Nov 2, 2013, 6:33:25 AM11/2/13
to london-c...@googlegroups.com

Hi –

 

At my company we run an annual speed-coding challenge and it’s my turn to set it next year. The format is we have four or five problems that take up to half an hour each; you get points for being the first to submit a working solution plus style points for good code or completing bonus challenges. The output of each problem is usually a number or a generated image so it’s easy to judge whether it’s worked, and you can tell people that they’re wrong quickly so they can keep trying. For expediency people don’t usually use TDD (although I’ve a few anecdotes where it would have helped me!) so I’m planning to set a question next year that requires TDD. But I’m not sure how best to do that. So far I’ve got ideas

 

·         solve a problem as usual, but require that the submitted solution has a test suite with >X% code coverage? The drawback with this is that people still need instant ‘no, you’ve failed’ feedback to keep working on the problem; I can set up an automated submission system with a CI server but we don’t like to restrict people’s language choices, so I’d need to poll what languages and test frameworks people want to use ahead of time and set that up to accommodate everyone.

·         ditto solve a problem but require they commit to git frequently and submit a repository showing incremental test and development? Again short of automated coverage testing I’d need to judge this manually, and that’s not going to be instant as before. If I mandate each commit message start with “red”, “green” or “refactor” it might be possible to automatically verify the content of the commit, but that wouldn’t be trivial to get right. Or I could judge this afterwards and weight the scoring for that question towards style points / penalties.

·         provide a suite of unit tests already written that they’ll have to implement? Ditto again I’d need to cover all languages people want to use, and this doesn’t feel like TDD to me because they wouldn’t be writing the tests themselves.

·         set a problem where the design would fall out easily with TDD but is very difficult to approach otherwise? I’m not sure how to construct that though.

 

Any better ideas or suggestions?

 

Thanks!

Rupert.

 

Reply all
Reply to author
Forward
0 new messages