Thursday, April 18, 2013

Constants here, constants there, constants everywhere

As I'm writing Mastermind, I notice I reference the size constant a lot. It feels like it's in every class with logic. It makes it a little hard to test because I can't use my unit test to determine if the class will work if I change the size. What else can I do? Well, I can set the size in game and let the game tell all the other classes what the size is. But that means all the classes would have a reference to game, just to know the size. What's a better way to do this? These are the type of questions I hope I can answer by the end of my apprenticeship or at the least know someone who does.

If you ask why I think something is wrong with constant being reference everywhere? I feel if it's hard to test, I'm probably doing it wrong.

0 comments:

Post a Comment