wolfenste / tictactoe

0 stars 0 forks source link

Map constructor is too error prone #4

Closed flavius closed 6 years ago

flavius commented 6 years ago

Specifying structured data as strings like this:

    $marks = array (
        '(1, 1)' => '', '(1, 2)' => '', '(1, 3)' => '',
        '(2, 1)' => '', '(2, 2)' => '', '(2, 3)' => '',
        '(3, 1)' => '', '(3, 2)' => '', '(3, 3)' => ''
    );

is too error-prone.

You've just invented a syntax '(number, number)', in order to parse it again just one step later (in Map::__construct).

Why not feed into Map data already structured in a way which doesn't need more parsing?

flavius commented 6 years ago

Read all the other issues first to get an idea of alternative approaches.