• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Lil_Lloyd

Is this really Test Driven Development or am I barking up the wrong tree?

7 posts in this topic

Recently I've been reading up on TDD in response to a job posting, and I have to say it's very interesting. After looking at some online sources and also the "Test Driven Development by Example" book I thought I'd try some on a different example by myself. I have summarised the proceedings here http://www.lloydcrawley.com/are-you-down-with-the-tdd-test-driven-development-experiments/ and was wondering is this really the 'TDD Method'? Or am I just kidding myself?
0

Share this post


Link to post
Share on other sites
That's the theory. In practice there is almost no one that uses it, but people like to talk about it. It drives your attention away from good code structure and logic, you begin to cheat in order to make the test pass and that is not good at all.
-2

Share this post


Link to post
Share on other sites
[quote name='Freya' timestamp='1348553440' post='4983474']
In practice there is almost no one that uses it, but people like to talk about it. It drives your attention away from good code structure and logic, you begin to cheat in order to make the test pass and that is not good at all.
[/quote]

This is just not true. Granted there is a lot of talking about TDD and it's thrown around a lot in managment-circles, but TDD is used in real life. Maybe not so much in the gaming industry, but in b2b market it's alive and kicking. Designing and writing tests is hard work and needs a lot of skill, but once you and your team is used to it it enhances the quality of your code. "Cheating" around a good set of tests can be almost as hard as writing clean code that fulfills all the tests. On the other hand the creed of TDD is that once you pass all the tests your task succeeded, so there is technically no cheating possible. Since you will extend your test set in the future your cheats will fail to pass all the tests at some point which will force you to fix your hacks.
TDD is all about getting correct behavior of a program, it doesn't prevent any kind of ugly code or design.
2

Share this post


Link to post
Share on other sites
[quote name='Freya' timestamp='1348553440' post='4983474']
That's the theory. In practice there is almost no one that uses it, but people like to talk about it. It drives your attention away from good code structure and logic, you begin to cheat in order to make the test pass and that is not good at all.
[/quote]

If I've got the basic theory down then I'm happy. I've started looking into it in response to a job ad I've applied for that has "proficient with Test Driven Development" as a requirement. The job ad is here: http://jobs.gamasutra.com/jobs/131931-31402/Kojima-Productions-in-Japan-Animation-Engine-Programmer-Kojima-Productions-Japan-HQ-Konami-Group-To-JPN?keywords=japan
0

Share this post


Link to post
Share on other sites
There's a subtle problem behind the philosophy of test driven development. It reminds me of set theory, so I'll use that to illustrate the issue.

Suppose you create a set of tests which your code needs to pass:

TDD = {A,B,C,D,E,F}

You write code which passes each of the tests in the set. However, the set was an [i]incomplete set[/i] of tests. You also needed to add tests {G,H,I, J, ???}. Unfortunately, these tests are part of another set called the "unknowns" which will always exist (which is composed of the two sets "unknowable unknowns" and "knowable unknowns"). Sometimes, these "unknowns" are simply the result of a lack of imagination on the part of a single test writer. Getting multiple people to give inputs on possible test cases can mitigate this, but there can still be unimaginable test cases which occur in reality. The size of the unknown set and the contents of the set is a complete mystery.

So, the [i]complete[/i] set of tests is a combination of sets:

Complete Set = {TDD set} + {??? set}

The result is that even if you religiously follow your TDD practice with perfectly writen test cases, it's [i]not[/i] [i]a guarantee[/i] that the developed software will be without errors. In practice, it yeilds good results and is a good methodology for generating quality code, but don't drink too deeply of the kool-aid.

Real world example: One of the space shuttles burned up in the atmosphere on re-entry because [i]chunks of foam[/i] damaged the heat tiles during lift off. Nobody imagined that foam travelling at high velocities would have any effect on the shuttle chasis.
2

Share this post


Link to post
Share on other sites
[quote name='slayemin' timestamp='1348579678' post='4983564']
The result is that even if you religiously follow your TDD practice with perfectly writen test cases, it's not a guarantee that the developed software will be without errors. In practice, it yeilds good results and is a good methodology for generating quality code, but don't drink too deeply of the kool-aid.
[/quote]

That is exactly why TDD is hard work and needs quite a bit of experience to yield good results. Having good specifications for what a software should be able to do and where it's limits are is also essential here.

The sets of tests needs extending over time to accommodate for those "unknowable unknowns" as soon as they become known. Two of the most common mistakes I've seen in teams using TDD, were either neglecting to extend the test set or instead of extending just [i]changing [/i]the existing tests so that they passed again. Writing tests should become an ordinary part of programming for the developers and not just be done in a separate sprint or only up front.
Luckily compared to the spaceshuttle-example software is usually not destroyed on a critical error and can be patched to work [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]


[quote name='Lil_Lloyd' timestamp='1348558739' post='4983498']
I've started looking into it in response to a job ad I've applied for that has "proficient with Test Driven Development" as a requirement.
[/quote]

Quick word of warning here, as with many development-topics getting the theory right might not yet make you "proficient with Test Driven Development". Edited by doeme
0

Share this post


Link to post
Share on other sites
Also beware that many business types misuse test driven development. In software circles, it means "write the tests first, and do no more work than is necessary to pass those tests."

In business circles, it very often means "developers write automated unit tests".
2

Share this post


Link to post
Share on other sites
In industry, we DO use TDD. Just not exclusively for everything.

In some respects, it's more about thinking about how your code will be used. Writing the tests first can help, because it lets you design the API cleanly in a way which works (from the POV of the test-harness).

Unfortunately, unit tests are not a universal panacea:
[list]
[*]The best set of well-designed, well thought-out, peer-reviewed unit tests, will never find a serious bug which appears instantly once a customer uses the software
[*]Some engineers are tempted to "over engineer" their unit tests - mocking lots of other components etc, and end up with a fabulously complicated, brittle unit-test which really does very little testing.
[*]Unit tests CAN slow down development. Chiefly, because every time an engineer breaks them, he has to spend time diagnosing why they are broken. This is especially true if they are brittle or unreliable.
[/list]
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0