Friday, February 4, 2011

A Different Look at Unit Testing

Today, I just wanted to put something out there that just came to light. So, recently, I've been working with my game team at DigiPen for awhile now and I noticed how often we ended up asking each other for whatever they were responsible for like text, graphics, physics, etc. Questions came up like "How do I get this text to show up?", "what am I missing to get this to work?", "how do you use this something() function call?" I started thinking of how I would help fix this. Then I started thinking of unit testing. Weird, I know. I understand how unit testing is there to help flush out initial bugs early on before they grow like a virus. But what happens after the unit testing is finished and done with? Why not use them as sample code for the other programmers?

For example, a programmer in charge of the level's editor needs to add text to various spots. He could try to find the guy who worked on the text system or look through their database of code for something similar to what he is trying to do. If the company set it up so that every unit test is stored somewhere for easy access, that programmer can easily read and figure what he needs to do while staying productive. I'm not trying to condone asking questions or communicating with your colleagues. I'm just saying that by having access to well established unit tests or just any type of unit test in general will greatly remove any or all black boxes the programmer may see or encounter.

Personally, I'm fine answering questions about the system I've built. But if I get too many questions of the same thing, then it's probably best I create a unit test of how it should basically be used than constantly giving the same answer. Not only am I helping my fellow programmers understand how my stuff is being used, but I also test to make sure my stuff to top notch.

Well, anyways, that's my two cents for today. I just thought I share this as I thought this was an interesting way to stay productive.

No comments:

Post a Comment