I was playing Resident Evil 7 - Biohazard DLC’s with my brother and I decided that the game 21 aka Jack Black was easy enough to help me practice my Swift programming skills. And so I did:
I have used Swift-UI to create this project. During the project creation I have faced some issues not with swift but the I code things.
Since I have a very strong React background, I’m used to write screen logic very close to the UI. Both in this project and in my Section 15: Day 15 - Intermediate - Local Development Environment Setup & the Coffee Machine I have noticed that this approach could lead to some issues.
The main issue is decoupling. Since the business logic is very close to the UI interactions it becomes hard to read the business logic only, and to Unit test the code. Using React we have the amazing React Testing Library that allows us to create “integration UI” tests that at the same time also tests the ”front-end code”.
A lot of resources like Untitled and Untitled approach this by creating a diagram and drawing the solution before actually coding. I have never tried this before, which makes me inclined to try this next.
Another great approach described by Bob Martin is by refactoring the code after it works, letting TDD create the architecture, always focusing in not letting framework-specific abstractions touch your business implementation.
Retrospective