Always at 23.59 on the same day as your TA session (Except if another deadline has been agreed with the TA). Consult the deadline for your class on the delivery plan.
The learning goals are Private Interfaces, Test Spy and again the compositional design principles.
Carefully read FRS § 37.5 which outlines the Interface-Segregation-Principle and private/role interface refactoring, and the new EtaStone and SemiStone (and optionally ThetaStone) variants. FRS 2nd Edition §15.8 and §15.9 provides the theory you need.
Spend the first 15-20 minutes of the class in plenum discussing...
Briefly read the FRS's §37.5 about a MutableGame private interface, in order to addresse the following Kata...
We need to TDD that a card effect like Brown Rice: "Deal 1 damage to opponent hero" works correctly. We can do this either by unit testing the effect or integration testing the effect. Unit testing means "in isolation" while integration testing means "in collaboration".
Thus integration testing the Brown Rice effect would follow a GWT like:
GIVEN a Game with Peddersen Hero health equal to 21 WHEN Findus plays the Brown Rice Card to the field THEN Peddersen's hero's health is 20That is - both the card, its effect strategy, the game object, and the hero object are all required to verify correct behaviour. And any defect in any of them, may make the test fail.
However, unit testing the Brown Rice effect would isolate the effect object completely, which would then amount to a GWT like:
GIVEN the Effect object (instance of the Effect Role interface) for Brown Rice WHEN the 'execute(mutableGame)' method is called THEN the Test Spy (implementing MutableGame) has recorded that the method 'changeHeroHealth(who, delta)' has been called with who=Peddersen, and delta=-1.That is, no other object but the effect itself and a spy object is involved.
Sketch code for the unit testing approach:
Refactor your HotStone code base to adhere to the Program to an Interface principle by introducing appropriately named private interfaces to handle mutation of internal game state.
Document your design as outlined in the report template.
FRS 2nd Edition §15.8 provides the theory you need, and, as a supplement, I have written this cheatsheet for private interface.
Note that this exercise strongly requires you to have developed a private interface for Game, as outlined in the previous exercise, to be solved correctly!
Develop EtaStone using TDD by refactoring the existing HotStone production code, and using a Test Spy to ensure card effects are Unit Tested, and not Integration Tested.
Document your card effect testing and argue for unit testing as outlined in the report template.
Develop the SemiStone variant: The combination of all your most playable HotStone variants. Including ThetaStone, below, is of course optional.
Document your design as outlined in the report template.
Consider the situation that you have designed all variants using a purely parametric design . That is, all variable behaviors are controlled by if's and switches in a single large implementation of Game containing code for all the requirements.
Sketch how method 'getWinner()' would look like this if a purely parametric design had been employed as variant handling technique in the HotStone code.
Consider the situation that you have designed all variants using a purely polymorphic design. That is, a design in which variants are created by subclassing the original AlphaStone implementation, like shown below:
For instance, the BetaStone winning algorithm would be handled by overriding the getWinner() method in class AlphaStone, etc.
Develop ThetaStone using TDD and by generalizing/extending your HotStone production code. Be sure to use a role interface for Categories.
This is purely an optional exercise, for 'fun' and improved game play.
Deliveries:
Your submission is evaluated against the learning goals and adherence to the submission guidelines. The grading is explained in Grading Guidelines. The TAs will use the Iteration 6 Grade sheet to evaluate your submission.
Learning Goal | Assessment parameters |
Submission | Git repository contains merge request associated with "iteration6". Git repository is not public! Required artifacts (report following the template) are present. |
Private Interfaces | The report clearly and concisely describes the new design of card, hero, game using private interfaces. Casting to concrete classes/declaring datastructures by concrete classes have been removed. The code base and code examples correctly reflect introducing private interfaces. |
EtaStone Design | The EtaStone/card effect is designed and coded using a compositional/3-1-2 approach. The design uses a Role Interface. The design is clearly and correctly documented in the report. |
Unit Testing via Test Spy | The card effects of EtaStone is TDD/tested by unit testing and a test spy. |
SemiStone | The report clearly and concisely describes the SemiStone configuration table and configuration code. The compositional design principles are correctly applied in the code base to support all variants and in particular support the multi-variance SemiStone. There are no source-code-copy, parametric, or polymorphic based variant handling code. The 'variant to use' code is localized in the ConcreteFactory for each variant. |
Parametric Analysis | The report clearly and concisely presents a correct solutions to the parametric 'getWinner()' through correct (pseudo) code fragments. |
TDD and Clean Code | TDD process has been applied. Test code and Production code keeps obeying the criteria set forth in the previous iterations, including adhering to Clean Code properties for newly developed code. Missing features are noted in the backlog (ThetaStone features allowed there (permanently)). |