Diary:Today something clicked, not sure what though

While I was introducing different game types in my tic tac toe game, using constructors like so..

public Game(Board board, IGameConsole, console, HumanPlayer humanPlayer, ComputerPlayer computerPlayer)

public Game(Board board, IGameConsole, console, ComputerPlayer computerPlayer, ComputerPlayer computerPlayer)

public Game(Board board, IGameConsole, console, HumanPlayer humanPlayer, ComputerPlayer computerPlayer)

I realised that this is how I’m supposed to do it, first introduce the duplication then refactor. I tell myself this all the time but sometimes I get frustrated and I instead want to take a shortcut which invariably leads me to a complex path.
It seems so obvious now and I now this but time again and again it comes back to me displining myself. This is why we do katas, it teaches us this! I guess there’s nothing quite like repetition to make best practices stick.

So next step will be to generalize this duplication, whether it is to create a new class or a method, I’ll decide once I’m at that crossroad, but for now, I’ll leave the duplication there as I slowly refactor other parts of the code to make it cleaner.

I have a strong feeling I’ll be learning and relearning this kind thing again and again through my apprenticeship, it feels like 2 steps forward, 1 step back sometimes.

But hey, it least it’s a step forward.

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