Diary: Introducing the Game setup class

Today was a challenging day trying to introduce the game setup class.

I couldn’t decide on an elegant solution to the problem, I considered different approaches and finally settled on passing in a game object into the game setup class and then call a host of setter methods on it.

Like so..

if (userChoice == 1) {

game.setHumanVsComputerGame();
}
else if (userChoice == 2) {
game.setHumanVsHuman
}

else if (userChoice == 3) {
game.setComputerVsComputer()
}
}

I found the this was probably the best option I had to get me to continue moving forward. However I don’t like the idea of mutating the game object, instead what I would prefer is to construct a new game object through a factory perhaps.

I look forward to the iteration meeting so I can cover this issue with my mentor.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s