Timeline for TDD: Create a Game logic using Test-First Programming
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 22, 2019 at 16:04 | comment | added | herby | Actually, I added one more things, see the edit. | |
| Jul 22, 2019 at 16:04 | history | edited | herby | CC BY-SA 4.0 | Addition: top-down to derive API of dependents |
| Jul 22, 2019 at 13:15 | history | edited | herby | CC BY-SA 4.0 | typo |
| Jul 22, 2019 at 13:08 | comment | added | herby | Maybe "having a public interface to run the game" and "doing the game logic" are two responsibilities. If you will have GameLogic class which can have more structured (and public, that is, testable) interface (Start(), HandleFoo(), HandleBar(), Finish(), ... making things up) and Game which would just a facade that calls proper things on GameLogic in its Run method, you may have these two reponsibilities divided, and then testing naturally is easier for both parts. | |
| Jul 22, 2019 at 12:34 | comment | added | Maloooo | Thanks for the answer. I agree with you, I was probably biased by the fact that in game dev you usually have an Update method that does all the logic of the game. I'm passing the Player to the Game using the constructor so that I can use a Fake or similar in other tests and I'm also passing an EnemyFactory to the Game that creates the Enemies, so I just edited my question to be more clear. So you are suggesting to move the logic into a Step() method, and that one would be public? Or pass into Game some external logic that has the Step method? and test that one? | |
| Jul 22, 2019 at 12:09 | history | answered | herby | CC BY-SA 4.0 |