wolfenste / tictactoe

0 stars 0 forks source link

Magic Values #13

Closed flavius closed 6 years ago

flavius commented 6 years ago

Magic values lik '', 'X', '0', 'end' etc should be constants in the value object classes they are held by.

Examples:

new Mark(Mark::SYMBOL_X).

new GameState(GameState::END).

This allows for tooling. For example, IDEs can "look up symbol" to find other usages.

Also important to note, that magic values with different meanings should have separate symbolic constants. For example, I can imagine '' having another meaning than Mark::SYMBOL_NONE in another context, so you have to introduce for that one another symbolic constant like AnotherValueObject::SOMETHING.