MACS_GOMOKU icon indicating copy to clipboard operation
MACS_GOMOKU copied to clipboard

Cleaned up "Clean Code" in business logic

Open trimmurrti opened this issue 7 years ago • 0 comments

This PR was created for the sole purpose of showing my students, that the ideas behind clean code are questionable, if the author himself can't use his own ideas in his code.

Another important point was to show how important it is to actually know the target platform and to delve deep into the intrinsic depth of the language, especially, if it has type inference in it. The code prior to the pull request is a perfect example of a code written with the lack of knowledge of the target platform.

The secondary aim of refactoring was to show my students, how to avoid unsafe force-cast related code, decompose the drawing logic for testability and how to use types to their fullest.

I do acknowledge, the goal of the repo is to market authors videos, so approval of the pull request, that overhauls all the business logic and introduces additional decomposition necessary to make GridView testable, would not be beneficial to the repo goal. However, I really want that hacktoberfest t-shirt (dunno why myself), so I'll do it either way.

As an additional bonus, it could be useful to Swift learners, as a way to look at another way of writing and decomposing Swift code.

P.S. I doubt the maintainer would merge the pull request, so I didn't update to Swift 4. If accept happens unexpectedly, I would refactor it to swift 4 with pleasure.

trimmurrti avatar Oct 13 '17 20:10 trimmurrti