Speed Challange: MineSweeper – Actual Programming

Since most of the design was documented and well-defined by the Use-Cases, I decided to go in a Copy/Paste approach: I would take the Use-Case directly into the development environment and translate each line into code.

Taking Use-Case text and transforming it into code

Minesweeper code

About 80% of the methods i wrote involved translating 2-3 sentences in English into C#. Since most of the logic was already encompassed within those lines, it allowed me to steamroll through the code without straying through the design process.

Even though the task of writing the code took much less time, the code came out much more organized and well documented.There were a few processes which the Use-Cases did not cover such as the GetNumberOfSorroundingMines(). I admit that I did not had them in mind while writing the Use-Case document.

I found that they contained absolutely zero comments. But since they contained such a low code complexity – writing such amount of Use-Case and code comments will be either a design overkill or unnecessary time overhead to such secondary code.

Minesweeper non-Use-Case method

Minesweeper non-Use-Case method

I found it most useful to use the NotImplementedException as a bookmark to jump between implementation of methods. Some of the Use-Cases contained references to other and in some cases I had to take actual breaks which left loose-ends in my code.

Minesweeper Code

NotImplementedException

A few more features are left such as the High scores table and the game timer, but other than that – the minesweeper is pretty much done :)

This entry was posted in Speed Programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


* 7 = sixty three

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>