Cags
Contributor
I'm looking for guidance here on best practice. I recently programmed a Sudoku application which can help solve various forms of 'Doku' puzzles. These include normal Sudoku (9x9), GoDoku (9x9 with letters), SuperSudoku (12x12) plus a few more different types. Now each of these puzzles share exactly the same properties which include grid dimensions, mini grid dimensions, character set etc.
I created a 'Doku' class that contained each of these properties, but have been torn how to proceed after that. One option is to have an overload for the constuctor that excepts all the relavent data so for example...
Another option I considered (and is the way I'm currently doing it) is to inherit from the doku class and simply have the constructor of the inherited class set all the default values for me. This in my opinion makes the code more readable as it allows me to simply use...
Basically all I'm asking for is if there is any reason this would be bad practice, it certainly works.
I created a 'Doku' class that contained each of these properties, but have been torn how to proceed after that. One option is to have an overload for the constuctor that excepts all the relavent data so for example...
C#:
Doku myDoku = new Doku(new Size(9,9), new Size(3,3), new Char { ... });
C#:
Doku myDoku = new Sudoku();