So, my XBox is bored. Or so it says anyway. Although it is temporally disturbed - still being on US time. So the blog dates don't quite match with reality here in Denmark.
Oblivion rocks. But I don't really feel that I am making much progress. There are so many things to do and see so I keep getting thrown off the main track. Closed my second Oblivion gate the other day and I am working hard to get all the reccomendations for getting further with the Mage Guild stuff.
Tomb Raider kicks ass well. I have always been a fan of the genre, and TR sets a very high mark. There are some lame things though - completed a motorcycle section which just seemed like a complete waste of time and energy. I can understand why they want to break the rhythm of the game to get a more cinematic experience. But that is not the way to do it.
Monday, May 08, 2006
Thursday, May 04, 2006
Unit testing granularity
I read this post from Jason, who has recently taken up his game development project and related blogging. Keep up the good work dude! His post touched on granularity in unit testing, and this inspired me to blog.
When I started unit testing my testing was very structured so I had a test class per real class and a test method per method and per property. That worked well for a while, but for a large project I ran into the problem that my test methods became quite large because I tested the effect of the method in several different scenarios. My case was to try to optimize the test to test everything the method did in one place. I also methodically tested assumptions before doing the actual test - often testing that the same call did not return null before working with the actual result several times in a method. The result was often very long test methods for a single method - but at least I knew where that perticular test was and could track where the event went wrong.
After attending a course where we touched on the subject, I got a few points hammered down and I changed my strategy a bit and begun testing with a higher granularity. Now I have several test methods per method where every test test exactly one aspect of the method. I make sure that no tests are repeated, so if I have a test that test that under the conditions set up the method does not return null, I exepect the result not to be null in other tests. Furthermore I set up several distinct test classes for a class if there are different preconditions for the class. This is usually classes that hold some stae but are note yet ripe for being refactored into different state classes. The test class set up the right preconditions and then test the class under those conditions.
The end result is that I now have a significantly higher amount of test methods, and some of them correspond directly to methods, others correspond to different aspects of the functionality of the function. All test methods are also very short, having only one or two assert statements each. The effect is that though you have to look for the right method that fails, and you can have false positives in your failures, the code is much easier to read and understand. Furthermore when you change functionality for a method, I have to change only one or two test methods in order for it to work. Before I had to change several places in a single test method that could be hard to find, and because I was "methodical" enough to test my preconditions, a change could very well mean changes to several other test methods as well.
So my take on granularity is to keep it high. Make small methods that test one aspect of one method, and one thing only. Name the method so you know what it tests. When testing complex scenarios, set things up as preconditions in a sepereate class, write a single test that sees that the preconditions are met, and then assume that they are met in the oher test methods.
When I started unit testing my testing was very structured so I had a test class per real class and a test method per method and per property. That worked well for a while, but for a large project I ran into the problem that my test methods became quite large because I tested the effect of the method in several different scenarios. My case was to try to optimize the test to test everything the method did in one place. I also methodically tested assumptions before doing the actual test - often testing that the same call did not return null before working with the actual result several times in a method. The result was often very long test methods for a single method - but at least I knew where that perticular test was and could track where the event went wrong.
After attending a course where we touched on the subject, I got a few points hammered down and I changed my strategy a bit and begun testing with a higher granularity. Now I have several test methods per method where every test test exactly one aspect of the method. I make sure that no tests are repeated, so if I have a test that test that under the conditions set up the method does not return null, I exepect the result not to be null in other tests. Furthermore I set up several distinct test classes for a class if there are different preconditions for the class. This is usually classes that hold some stae but are note yet ripe for being refactored into different state classes. The test class set up the right preconditions and then test the class under those conditions.
The end result is that I now have a significantly higher amount of test methods, and some of them correspond directly to methods, others correspond to different aspects of the functionality of the function. All test methods are also very short, having only one or two assert statements each. The effect is that though you have to look for the right method that fails, and you can have false positives in your failures, the code is much easier to read and understand. Furthermore when you change functionality for a method, I have to change only one or two test methods in order for it to work. Before I had to change several places in a single test method that could be hard to find, and because I was "methodical" enough to test my preconditions, a change could very well mean changes to several other test methods as well.
So my take on granularity is to keep it high. Make small methods that test one aspect of one method, and one thing only. Name the method so you know what it tests. When testing complex scenarios, set things up as preconditions in a sepereate class, write a single test that sees that the preconditions are met, and then assume that they are met in the oher test methods.
Friday, April 21, 2006
1..2..3.. Launch
So it is official. The first game created by Gosuman Games is live and vital. It is a game made for Netposten and is a simple stock guessing web-based game. I am actually quite pleased with how the game turned out, and of course getting to get payed to write a game. That, in itself, is a first for me. So while it is not an idea of my own, it is there and live. Check it out, if you read danish that is, otherwise you are USC for now. They have great prizes as well, there is a chance to win an iPod... Not bad for a game that only runs for a week at a time!
Of course it brings the nag of not completing my first independant production to mind... But my calendar for may looks like it might give some opportunities.
My project at ITU is nearing completion. We had a great meeting with our tutor today, she confirmed that we were on the right track. There is still some writing to do, and a lot of restructuring, but I think we are in good time. We originally had to hand it in next friday - but guess what. Steve Ballmer is coming to visit ITU, so we get a few days extra time to hand it in. Guess the security surrounding the handing in of projects is too much to handle when combined with Steve-O. :)
Lastly, i read newest The Escapist mag today. Mostly by accident, I had stumbled on it before where it didn't pique my interest. But this time I found myself suddenly reading the whole issue. And enjoying it too. So, maybe I'll become a regular reader.
Of course it brings the nag of not completing my first independant production to mind... But my calendar for may looks like it might give some opportunities.
My project at ITU is nearing completion. We had a great meeting with our tutor today, she confirmed that we were on the right track. There is still some writing to do, and a lot of restructuring, but I think we are in good time. We originally had to hand it in next friday - but guess what. Steve Ballmer is coming to visit ITU, so we get a few days extra time to hand it in. Guess the security surrounding the handing in of projects is too much to handle when combined with Steve-O. :)
Lastly, i read newest The Escapist mag today. Mostly by accident, I had stumbled on it before where it didn't pique my interest. But this time I found myself suddenly reading the whole issue. And enjoying it too. So, maybe I'll become a regular reader.
Thursday, April 20, 2006
OMG its that time already
Wow... Time has been flying by. Last post Feb 22. Hmm... I have been doing a lot of stuff. Working mostly. The game I have made for Netposten is about to launch, I have been doing some work on an ASP.NET/Sitecore thins for AlphaSolutions and some random stuff... And then I have my project on ITU that is nearing completion. It is to be handed in next friday - so I just have to overcome my writers block. But when it is done I will start feeling good about things again. This is just one of those times when a lot of different things have to be wrapped op - preferably all at the same time.
Wednesday, February 22, 2006
C# Edge
Just discovered that my good friend Troels has a Blog too called C# Edge. He is doing some amazing AJAX stuff with his OutPost module. Today I just saw that he got listed in Daniel Ziess' great AJAX comparison chart.
I, frankly, have to learn that stuff very soon. I am doing a game for a comapny called Netposten right now, pure ASP.NET, and it could surely use some snazzy AJAX features.
I, frankly, have to learn that stuff very soon. I am doing a game for a comapny called Netposten right now, pure ASP.NET, and it could surely use some snazzy AJAX features.
Monday, January 23, 2006
Third party product testing
Seems like it wasn't just a bad brainwave I had when I posted about testing 3rd party libraries. James Greening did a post on this as well. Saves me the trouble of elaborating. ;-)
Friday, January 20, 2006
Exam. Done!
So it is finally over. I had my exam yesterday morning. It went well. My grade was 10 (on a special danish scale to 13). And I am satisfied with that. Now I can practice relaxing. Some.
I am picking up my laptop that has been broken since monday. I had actually managed to break the motherboard (and the screen), how I did that I dont know. But they replaced both. Price: 3900 kr. Ouch. I could buy a new desktop for that money. Happily I aint paying. But I know now to be very careful. It is the first time in my 5 years of using a laptop only that I have broken one down. It is usually "only" the harddisk that breaks down. Which is actually worse!
This weekend we are going to our house in the country. I will be coding on a job that is up for first test monday, and Kat will be watching the royal baptism. All by the roaring fireplace. Can't get much better than that I assure you. It has been snowing heavily in denmark during the week, so it will be fantastic up there. Watch out for pics next week.
I am picking up my laptop that has been broken since monday. I had actually managed to break the motherboard (and the screen), how I did that I dont know. But they replaced both. Price: 3900 kr. Ouch. I could buy a new desktop for that money. Happily I aint paying. But I know now to be very careful. It is the first time in my 5 years of using a laptop only that I have broken one down. It is usually "only" the harddisk that breaks down. Which is actually worse!
This weekend we are going to our house in the country. I will be coding on a job that is up for first test monday, and Kat will be watching the royal baptism. All by the roaring fireplace. Can't get much better than that I assure you. It has been snowing heavily in denmark during the week, so it will be fantastic up there. Watch out for pics next week.
Subscribe to:
Posts (Atom)